只有24行的简洁代码,本地全通过,评测全WA dl们快来“绑猪”我!!

P1319 压缩技术

joey007 @ 2022-11-11 17:22:19

无语了

什么情况

本地都通过了

评测直接0分(全WA)

dalao们
求帮助

源代码:

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
    int square;
    cin>>square;
    int a[square * square + 10] = {0};
    bool pc = true;
    int times = 0;
    for(int i =1;i<(square*square);i+=a[i]0){
        cin>>a[i];
        pc = !pc;
        for(int j = 0;j<a[i];j++){
            cout<<pc;
            times++;
            if(times == 7){
                cout<<endl;
                times = 0;
            }
        }
    }
    return 0;
}

by LiaoYF @ 2022-11-11 17:27:33

@joey007 没说七个换行,是n个换行


by LiaoYF @ 2022-11-11 17:28:00

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
    int square;
    cin>>square;
    int a[square * square + 10] = {0};
    bool pc = true;
    int times = 0;
    for(int i =1;i<(square*square);i+=a[i]){
        cin>>a[i];
        pc = !pc;
        for(int j = 0;j<a[i];j++){
            cout<<pc;
            times++;
            if(times == square){//here
                cout<<endl;
                times = 0;
            }
        }
    }
    return 0;
}

by joey007 @ 2022-11-11 18:50:44

栓Q


by joey007 @ 2022-11-11 18:51:02

thanks


|