3572021-10-28 20:45:23Kevinke12JardaTcpp14Wrong answer 4/402ms1976 KiB
#include <iostream>
#include <bits/stdc++.h>
using namespace std;

long long A[105];
long long B[105];
long long JardaB(int h);

long long JardaA(int n)
{
    if(n<=0)
        return 0;
    if(n==1)
        return 1;
    if(n==2)
        return 2;

    if(A[n]!=0)
        return A[n];

    A[n] = (JardaA(n-1)%20200111+JardaA(n-2)%20200111+2*JardaB(n-1)%20200111);
    return A[n];

}
long long JardaB(int n)
{
    if(n<=0)
        return 0;
    if(n==1)
        return 0;
    if(n==2)
        return 1;
    if(n==3)
        return 2;
    if(n==4)
        return 4;

    if(B[n]!=0)
        return B[n];

    B[n] = ((JardaA(n-2)%20200111+JardaB(n-2)%20200111+JardaB(n-1)%20200111))%20200111;
    return B[n];
}
int main()
{

    int N;
    cin >> N;
    /*for(int i = 0;i <= N; i++)
        cout << i << ":" << JardaA(i) << "-" << JardaB(i) << "\n";*/
    cout << JardaA(N) << "\n";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/40
1Accepted0/02ms1812 KiB
2Wrong answer0/01ms1868 KiB
3Accepted1/11ms1920 KiB
4Accepted1/11ms1920 KiB
5Accepted2/21ms1928 KiB
6Wrong answer0/21ms1932 KiB
7Wrong answer0/31ms1932 KiB
8Wrong answer0/31ms1944 KiB
9Wrong answer0/31ms1940 KiB
10Wrong answer0/31ms1944 KiB
11Wrong answer0/31ms1956 KiB
12Wrong answer0/31ms1952 KiB
13Wrong answer0/31ms1964 KiB
14Wrong answer0/31ms1964 KiB
15Wrong answer0/31ms1968 KiB
16Wrong answer0/31ms1972 KiB
17Wrong answer0/41ms1976 KiB