5pts求助
查看原帖
5pts求助
768786
lol_qwq楼主2022/9/3 13:51
#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("lr");
    }
    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("llr");
            }
            cout << a;
            return 0;
        }else{
            if((x - y) % 3 == 1){
                for(int c = 1;c <= (x - y) / 3;c++){
                    a = a.append("llr");
                }
                a = a.append("l");
                cout << a;
                return 0;
            }
            if((x - y) % 3 == 2){
                for(int k = 1;k <= (x - y) / 3;k++){
                    a = a.append("llr");
                }
                a = a.append("ll");
                cout << a;
                return 0;
            }
           }
        }
    }
    return 0;
}
2022/9/3 13:51
加载中...