本地能过,但是全WA,萌新跪求帮助...

P1319 压缩技术

ParaSolitude @ 2022-10-20 09:51:24


#include<iostream>
using namespace std;
int main()
{
    int N,a,flag=0,word,end=0;
    cin >> N;
    for (int i = 0; i < N * N; flag++)
    {
        cin >> a;
        i += a;
        word = flag % 2;
        for (int k = 0; k < a; k++)
        {
            cout << word;
            end++;
            if (end % 7 == 0)
                cout << endl;
        }
    }
    return 0;
}

by Ykmirror @ 2022-10-24 22:31:25

@ParaSolitude

#include<iostream> 
using namespace std; 
long long a,b[1000009],cnt=0,sr,pdjo=1;
int main(){ 
    cin>>a;
    while(cin>>sr){
        if(pdjo%2==1){
            for(int i=0;i<sr;i++){
                if(cnt>=a){
                    cout<<endl;
                    cnt=0;
                }
                cnt++;
                cout<<0;    
            }
        }
        if(pdjo%2==0){
            for(int i=0;i<sr;i++){
                if(cnt>=a){
                    cout<<endl;
                    cnt=0;
                }   
                cnt++;
                cout<<1;
            }       
        }
        pdjo++;
    }
    return 0;
}

你看看我的


by caojiaming @ 2022-10-25 12:52:56

这b数组用都没用

请看看我的:

#include <bits/stdc++.h>
using namespace std;
int n,cur=0;
int a0,a1;
int main()
{
    cin>>n;
    while(cin>>a0&&cin>>a1)
    {
        for(int i=1;i<=a0;i++)
        {
            cout<<"0";
            cur++;
            if(cur%n==0)
            {
                cout<<"\n";
            }
        }
        for(int i=1;i<=a1;i++)
        {
            cout<<"1";
            cur++;
            if(cur%n==0)
            {
                cout<<"\n";
            }
        }
    }
    return 0;
}

我还创建了个讨论,无人回复


by ParaSolitude @ 2022-10-26 20:00:16

@caojiaming 非常感谢!


by ParaSolitude @ 2022-10-26 20:00:35

@mky12345 非常感谢!


|