爆零求助
查看原帖
爆零求助
768786
lol_qwq楼主2022/8/10 21:06
#include <bits/stdc++.h>
using namespace std;
string a = "";
int main(){
    int x,y,z;
    cin >> x >> y >> z;
    for(int i = 1; i <= y/2;i++){
    a = a.append("1r");
    }
    for(int j = 1; j <= x - y;j++){
    if(z - 1 >= x - y){
        a = a.append("r");
    }
    else{
        if((x - y) % 3 == 0){
            for(int t = 1;t <= (x - y) / 3;t++){
            a = a.append("11r");
            }
            cout << a;
            return 0;
        }
        else{
            if((x - y) % 3 == 1){
            for(int c = 1;c <= (x - y) / 3;c++){
            a = a.append("11r");
            }
            a = a.append("1");
            cout << a;
            return 0;
            }
            if((x - y) % 3 == 2){
            for(int k = 1;k <= (x - y) / 3;k++){
            a = a.append("11r");
            }
            a = a.append("11");
            cout << a;
            return 0;
            }
        }
        }
    }
    return 0;
}

自测样例符合,但还是爆零

2022/8/10 21:06
加载中...