??!!!(0'?)

P1319 压缩技术

___m_j_q___ @ 2021-08-23 16:13:38


#include<bits/stdc++.h>
using namespace std;

int main()
{   
    int n,i=0,jud=0,num=0,numm;
    cin>>n;
    while(num<=n*n)    
    {
        cin>>numm;
        i++;
        for(int j=numm;j>=1;j--)
        {
            if(jud==n) {cout<<endl;jud=0;}
            if(i%2==0) cout<<'1';
            else cout<<'0';
            jud++;
            num++;
        }
    }
    cout<<endl;
    return 0;
}

by ___m_j_q___ @ 2021-08-23 16:14:26

测试对的,提交全错……


by imnoob @ 2021-08-24 10:10:33

while(num<=n*n)

因为你的num初始值是0,所以要改成

while(num<n*n)

改一下就AC了


|