大神help me

P1319 压缩技术

Liyunheng2012 @ 2024-11-25 21:00:34

WHY?

本地过了,提交全WA了
#include<bits/stdc++.h>
using namespace std;
int n,t,sum,sum2;
bool f;
int main(){
    cin.tie(0);
    cout.tie(0);
    cin>>n>>t;
    while(n*n!=sum){
        sum++;
        sum2++;
        t--;
        if(f){
            cout<<1<<' ';
        }else{
            cout<<0<<' ';
        }
        if(t==0){
            f=!f;
            cin>>t;
        }
        if(sum2==n){
            cout<<'\n';
            sum2=0;
        }
    }
    return 0;
}

by CHkujiu @ 2024-12-29 18:24:27

求关

#include<bits/stdc++.h> 
using namespace std;
const int N=10010;
int n;
int ccc;
bool ch;
vector<int> a;
int main()
{
    int x;
    cin>>n;
    while(cin>>x)
        a.push_back(x);
    for(int i=0;i<a.size();i++)
    {
        ch=ch?false:true;
        int k=a[i];
        for(int j=0;j<k;j++)
        {
            cout<<(ch?"0":"1");
            if(ccc==n-1)puts("");
            ccc=(ccc+1)%n;
        }
    }
    return 0;
}

by CHkujiu @ 2024-12-29 18:24:37

@Liyunheng2012


|