P1031 输入输出都对,但是0分
查看原帖
P1031 输入输出都对,但是0分
251157
Aresene楼主2021/4/16 13:54

求助犇犇,这个0分,但是看了输入输出对了qaq

#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,ans = 0;
    cin >> N;
    int a[N],b[N];//b为CONST(仅为字面意思)
    for(int i = 1;i <= N;i++)cin >> a[i];
    while(bool tmp = 0){
        int tmp_bigest,tmp_comman;
        while(bool tmp__ = 1){
            for(int i = 1;i <= N;i++)b[i] = a[i];
            for(int i = N;i >= 2;i++)if(b[i] <= b[i-1])tmp_bigest = b[i-1];
            if(b[1] <= b[N])tmp_bigest = b[N];
            for(int i = 1;i <= N;i++)tmp_comman += b[i];
            int tmp_set = b[tmp_bigest] - tmp_comman;
            b[tmp_bigest - 1] > b[tmp_bigest +1] ? b[tmp_bigest - 1] += tmp_set : b[tmp_bigest +1] += tmp_set;
            bool tmp___ = 1;
            for(int i = 1;i <= N;i++)if(tmp_comman != a[i])tmp___ = 0;
            if(tmp___ = 0){ans++;continue;}else{tmp = 0;}
            tmp = 1;
        }
    cout << ans << endl;
    }
    system("pause");
    return 0;
}

虽然老师要讲

2021/4/16 13:54
加载中...