4 条题解

  • 0
    @ 2023-8-23 9:40:08
    #include<bits/stdc++.h>
    using namespace std;
    const int N = 1e3 + 10;
    const int K = 12345;
    int n;
    int f[N][2];  
    int main() {
        ios::sync_with_stdio(false);  
        cin.tie(0);
        cin >> n;
        if (n == 1) {
            f[1][0] = 8;  
            f[1][1] = 1; 
            cout << f[1][0] << endl;
        } else {
            f[1][0] = 9;  
            f[1][1] = 1;
            for (int i = 2; i <= n - 1; ++i) {
                f[i][0] = ((f[i - 1][1] % K) + (9 * (f[i-1][0] % K)) % K) % K;
                f[i][1] = ((f[i - 1][0] % K) + (9 * (f[i-1][1] % K)) % K) % K;
            }
            f[n][0] = ((f[n - 1][1] % K) + (8 * (f[n-1][0] % K)) % K) % K;
            cout << f[n][0] << endl;
        }
        return 0;
    }
    // 
    //     	   __  __          __  
    //  	  / / / /_  ______/ /________ 
    //       / /_/ / / / / __  / ___/ __ \
    //  	/ __  / /_/ / /_/ / /  / /_/ /
    //     /_/ /_/\__, /\__,_/_/   \____/ 
    //           /____/                   
    //
    
    • @ 2023-10-23 22:13:04

      用我的HYDRO是吧

信息

ID
362
时间
1000ms
内存
16MiB
难度
7
标签
递交数
226
已通过
60
上传者