0ps,求调

P1320 压缩技术(续集版)

thomas1234567 @ 2024-09-09 19:04:34

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int a;
    int b=0;
    int c=0;
    cin >> n;
    while(cin>>a)
    {
        if(b%2==0)
        {
            for(int i=1;i<=a;i++)
            {
                cout<<'0';
                c++;
                if(c==n)
                {
                    cout<<endl;
                    c = 0; 
                }
            }
        }
        if(b%2==1)
        {
            for(int i=1;i<=a;i++)
            {
                cout<<'1';
                c++; 
                if(c==n)
                {
                    cout<<endl;
                    c = 0;
                }
            }
        }
        b++;    
    }
}

by abc20131113 @ 2024-09-09 19:43:54

@thomas1234567 这个看一下
求关QWQ!求求了!


#include<bits/stdc++.h>  
using namespace std;  
char s1[201],ch;
int sum=1;  
char s[40001];  
int main(){  
    scanf("%s",s1+1);  
    int len=strlen(s1+1);  
    for(int i=1;i<=len;i++){  
        s[i]=s1[i];  
    }  
    int p=len;  
    for(int i=len;i<=len*len+len-1;i++){  
        scanf("%c",&ch);  
        if(ch=='\n'){  
            continue;  
        }  
        p++;  
        s[p]=ch;  
    }  
    printf("%d ",len);  
    if(s[1]!='0')
        printf("0 ");  
    for(int i=1;i<=len*len;i++){   
        if(s[i]==s[i+1]){  
            sum++;  
        }  
        else{  
            printf("%d ",
            sum);  
            sum=1;  
        }  
    }  
    return 0;  
};

by abc20131113 @ 2024-09-09 19:44:40

@thomas1234567 不知道你能不能看懂哈


by thomas1234567 @ 2024-09-10 19:00:27

看得懂


by pengsiqi11 @ 2024-10-24 22:16:15

@thomas1234567 please 看题, 你输出了什么?


by thomas1234567 @ 2024-12-03 12:42:17

已过,谢谢!


|