不晓得哪里出了问题 全wa 求大佬指点

P1319 压缩技术

Peranda @ 2018-08-11 21:48:28

#include<iostream>

int main() {
    int n;
    std:: cin >> n;
    int ans;
    int kk = 0, key = 0;;
    while (std:: cin >> ans) {
        for (int i = 1; i <= ans; i++) {
            if (kk % n == 0) std:: cout << "\n";
            kk += 1;
            std:: cout << (key & 1);
        }
        key += 1;
        if (kk == n * n) break;
    }
    return 0;
}

by 龘靐齉齾麤 @ 2018-08-11 21:53:07

有必要这样吗


by 龘靐齉齾麤 @ 2018-08-11 21:53:15

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d=0,i=0,s=0;//sdfaewrfawerfevsdrfruigyujuijdhjfg
    cin>>c;
    while(s<c*c)
    {
        cin>>a;
        i++;
        for(b=a;b>=1;b--)
        {
            if(d==c){cout<<endl;d=0;}
            if(i%2==1)cout<<0;
            else cout<<1;
            d++;
            s++;
            }
    }
    cout<<endl;
}

by 龘靐齉齾麤 @ 2018-08-11 21:53:27

如楼上


by 龘靐齉齾麤 @ 2018-08-11 21:53:38

@Peranda


by Peranda @ 2018-08-11 22:16:03

@龘靐齉齾麤

谢谢大佬 您的这样我是理解的 但是我想知道我的出了什么问题


by 龘靐齉齾麤 @ 2018-08-11 22:18:16

原来如此


by 龘靐齉齾麤 @ 2018-08-11 22:19:41

@Peranda 这不应该WA啊


|