样例过了,0pts,c++求调,玄关

P1319 压缩技术

wattzyh @ 2024-08-26 16:35:31

#include<iostream>
using namespace std;
int a[209];
int main(){
    int n;
    cin>>n;
    int sum=n*n;
    int cnt=0;
    while(sum>0){
        cin>>a[cnt];
        cnt++;
        sum-=a[cnt-1];
    }
    int flag=1,t=1;
    for(int i=0;i<=cnt;i++){
        flag=!flag;
        for(int j=0;j<a[i];j++){
            cout<<flag<<' ';
            if(t%n==0) cout<<endl;
            t++;
        }
    }
    return 0;
}

by GX_Richard @ 2024-08-26 16:36:59

@wattzyh 题目没叫你输出空格呀……


by GX_Richard @ 2024-08-26 16:37:16

@wattzyh 你把空格去掉就对了


by wattzyh @ 2024-08-26 21:52:55

@GX_Richard 已过,谢谢大佬,已关,求壶关


by wattzyh @ 2024-08-26 21:53:36

手残了......


|