6132021-11-04 18:35:30goczbaliJárda-L (40)cpp14Wrong answer 8/403ms1912 KiB
#include <iostream>
#include <vector>

int main() {
    int n;
    std::cin >> n;
    
    std::vector<unsigned long long> dp(n + 1);
    dp[0] = 1;
    
    for (int i = 1; i <= n; i++) {
        dp[i] = dp[i - 1];
        
        if (i >= 2) {
            dp[i] += dp[i - 2];
        }
        
        if (i >= 3) {
            dp[i] += dp[i - 3] * 2;
        }
        
        if (i >= 4) {
            dp[i] += dp[i - 3] * 2;
        }
    }
    
    std::cout << dp[n] << std::endl;
    
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/40
1Accepted0/03ms1740 KiB
2Wrong answer0/01ms1784 KiB
3Accepted2/22ms1852 KiB
4Accepted2/21ms1860 KiB
5Accepted2/21ms1860 KiB
6Accepted2/21ms1864 KiB
7Wrong answer0/21ms1868 KiB
8Wrong answer0/31ms1876 KiB
9Wrong answer0/31ms1876 KiB
10Wrong answer0/31ms1876 KiB
11Wrong answer0/31ms1880 KiB
12Wrong answer0/31ms1888 KiB
13Wrong answer0/31ms1888 KiB
14Wrong answer0/31ms1900 KiB
15Wrong answer0/31ms1900 KiB
16Wrong answer0/31ms1908 KiB
17Wrong answer0/31ms1912 KiB