问题标题: 酷町堂:50豆!!!

0
0
已解决
马苏畅
马苏畅
中级守护
中级守护

题目链接: 酷町堂:6492

#include<iostream>

#include<cstdio>

#include<cmath>

#include<string>

#include<algorithm>

using namespace std;

int n[500];

int main(){

    int a,b,c;

cin>>a;

for(int i=1;i<=2*a;i++){

cin>>n[i];

}

int cnt=0;

bool f=0;

for(int i=1;i<=2*a;i++){

for(int j=1;j<=n[i];j++){

cnt++;

cout<<f;

if(cnt%7==0){

cout<<endl;

}

}

f=!f;

}

    return 0;

}

0分???

大佬救我!!!


0
已采纳
王牌工作室官方
王牌工作室官方
新手光能
新手光能

cnt从1开始

王牌工作室官方在2022-03-23 17:29:54追加了内容

我是你的同学,@席清源,这是我的小号

王牌工作室官方在2022-03-23 17:32:57追加了内容

还有,输入数字个数需要你自己计算,不是单纯的2*a

可以while(cin.peek()!='\n'){}

不过不太精密,它只读取一行,(不过题目好像没有分多行的样例)

精密的是while(cin){}

我要回答