案例能过,但是0分!!

P1319 压缩技术

Oliveire @ 2024-05-07 00:20:24

#include<bits/stdc++.h>
using namespace std;
int main(void){
int n;
cin>>n;
int ans=0,sum=0;
int b,sum1;
while(sum1<n*n){
    cin>>b;
    ans++;
    sum1+=b;
    if(ans%2==0){
            for(int i=0;i<b;i++){   
                if(sum%n==0){
                cout<<endl;
                }
                sum++;
                cout<<"1";
            }
            }
            else {
                for(int i=0;i<b;i++){
                    if(sum%n==0){
                        cout<<endl;
                    }
                    sum++;
                    cout<<"0";
                }
            }
        }
        cout<<endl;
    }

by NoneCoding @ 2024-05-07 00:43:54

第7行sum1初始化后再试试


by Oliveire @ 2024-05-07 18:24:24

@NoneCoding 还是过不了


|