求助

P1319 压缩技术

Jayant_xincheng @ 2023-06-06 20:35:20

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{
    int n,tot=0,o=1;
    cin>>n;
    int y;
    while(cin>>y)
    {
        for(int i=0;i<y;i++)
        {
            if(o%2==0)
            {
                cout<<1;
                tot++;
            }
            else
            {
                cout<<0;
                tot++;
            }
            if(tot%7==0)
            {
                cout<<endl;
            }
        }
        o++;
    }
}

大佬帮一下


by elbissoPtImaerD @ 2023-06-06 20:49:35

@yangxincheng2 第 26 行应该将 %7 改为 %n,题目又没有保证 n 恒等 7


by Jayant_xincheng @ 2023-06-07 19:04:21

谢谢大佬 @elbissoPtImaerD


by Jayant_xincheng @ 2023-06-07 19:06:39

关注已送上


|