暴力,哪有问题
查看原帖
暴力,哪有问题
1043489
yiyezhiqiu1011楼主2024/8/7 11:22
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,m,a,x,up[66]={},pe[66]={};
    cin >> a >> n >> m >> x;
    up[1] = a; 
    if (x == 1 || x == 2)
    {
        cout << a;
        return 0;
    }
    for (int i = 0; i <= m; i++)
    {
        up[2] = i;
        for (int j = 3; j <= n; j++)
        {
            up[j] = up[j-1] + up[j-2];
            pe[j] = up[j] - up[j-1];
        }
        
        if (pe[n] == m)
            break;
    }
    
    cout << pe[x];
    
    return 0;
}
2024/8/7 11:22
加载中...