7 条题解

  • 5
    @ 2025-11-29 15:42:10

    包AC

    #include<bits/stdc++.h>
    using namespace std;
    long long x,y,z,a[10000],b[10000];
    int main(){
    	cin >> x >> y >> z;
    	for(int i=1; i<=x; i++){
    		a[i]=1;
    	} 
    	for(int i=x+1; i<=z+1; i++){
    		a[i]=b[i-2]+a[i-1];
    		b[i]=y*a[i-x];
    	}
    	cout << a[z+1];
    	return 0;
    }
    
    • 5
      @ 2025-11-29 15:41:22

      号称从未输过的法国赌神:

      皮克松

      #include <iostream>
      using namespace std;
      int main() {
         long a[101] = {0}, b[101] = {0};
         int x, y, z;
         cin >> x >> y >> z;
         for (int i = 1; i <= x; i++) {
             a[i] = 1;
             b[i] = 0;
         }
         for (int i = x + 1; i <= z + 1; i++) {
             b[i] = y * a[i - x]; 
             a[i] = a[i - 1] + b[i - 2]; 
         }
         cout << a[z + 1] << endl; 
         return 0;
      }
      
      • 1
        @ 2026-7-21 9:56:56
        • #include<bits/stdc++.h> using namespace std; long long x,y,z,a[10000],b[10000]; int main(){ cin >> x >> y >> z; for(int i=1; i<=x; i++){ a[i]=1; } for(int i=x+1; i<=z+1; i++){ a[i]=b[i-2]+a[i-1]; b[i]=y*a[i-x]; } cout << a[z+1]; return 0; }
        • -1
          @ 2025-3-23 18:52:56

          正解:

          #include<cstdio>
          #include<iostream>
          #include<cstring>
          #include<cmath>
          #include<iomanip>
          #include<queue>
          #include<algorithm>
          #include<vector>
          #include<stack>
          #include<set>
          using namespace std;
          #define LL long long
          const int N=100;
          using namespace std;
          long long a[110],b[110];
          int x,y,z;
          int main()
          {
          	cin>>x>>y>>z;
          	for(int i=1;i<=x;i++)
          	{
          		a[i]=1;
          		b[i]=0;
          	}
          	for(int i=x+1;i<=z+1;i++)
          	{
          		b[i]=a[i-x]*y;
          		a[i]=a[i-1]+b[i-2];
          	}
          	cout<<a[z+1]<<endl;
          	return 0;
          }
          
          
          • -1
            @ 2023-12-24 10:26:56
            #include <bits/stdc++.h>
            using namespace std;
            const int N=1e2+10;
            long long bug[60],egg[60];
            int x,y,z; 
            int main()
            {
            	cin>>x>>y>>z;
            	z++;
            	bug[1]=1;
            	for(int i=2;i<=z;i++)
            	{
            		if(i>=2)
            		bug[i]=bug[i-1]+egg[i-2];
            		if(i>=x)
            		egg[i]=bug[i-x]*y;
            	}
            	cout<<bug[z];
            	return 0;
            }
            

            递推初学者噩梦

            • -2
              @ 2024-5-19 18:54:46

              #include #include #include #include #include #include const int N = 1e7 + 10; const int INF = 0x3f3f3f3f; using namespace std; long long a[N],b[N],x,y,z; int main(){ cin>>x>>y>>z; for(int i=0;i<x;i++) { b[i]=0; a[i]=1; } for(int i=x;i<=z;i++) { a[i]=a[i-1]+b[i-2]; b[i]=a[i-x]*y; } cout<<a[z]; return 0; }

              • -2
                @ 2022-11-29 12:11:51

                #include #include using namespace std;

                long long f[55];

                long long s[55];

                int main() {

                int x,y,z;
                scanf("%d%d%d",&x,&y,&z);
                f[1]=1;
                for(int i=2;i<=z+1;i++)
                {
                	f[i]=f[i-1]+s[i-2]; //新增成虫数
                	if(i>=x)    s[i]=f[i-x]*y; ////x个月前的虫卵数 
                }
                printf("%lld",f[z+1]);
                return 0;
                

                }

                • 1

                信息

                ID
                1266
                时间
                1000ms
                内存
                256MiB
                难度
                5
                标签
                递交数
                318
                已通过
                125
                上传者