1 条题解
-
0
按数字3出现次数的奇偶性递推,首位排除0,答案始终对12345取模,覆盖N=1和1000位。
#include <bits/stdc++.h> using namespace std; int main(){ios::sync_with_stdio(false);cin.tie(nullptr); int n;cin>>n;int even=8,odd=1;for(int i=1;i<n;i++){int a=(even*9+odd)%12345,b=(odd*9+even)%12345;even=a;odd=b;}cout<<even<<"\n"; return 0; }
- 1
信息
- ID
- 3988
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 5
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者