#include <stdio.h>
#define ll long long

struct count { char c; ll cnt; };
count Rabbithorse[10]={
{'R', 1}, {'a', 1}, {'B', 2}, {'I', 1}, {'t', 1}, 
{'h', 1}, {'O', 1}, {'R', 1}, {'S', 1}, {'e', 1}
}; //B 개수 = cntC2

char s[11]="ChinoCocoa";

int main() {
    int n;
    scanf("%d", &n);

    if(n<11) printf("%s", s+(10-n));
    else {
        ll max=1;
        for(int i=12; i<=n; i++) {
            int idx;
            ll tmpmax=1;
            for(int j=0; j<10; j++) {
                ll val, CNT = Rabbithorse[j].cnt;
                if(j==2) { //B
                     val = max*(CNT+1)/(CNT-1);
                }
                else {
                    val = max*(CNT+1)/CNT;
                }
                
                if(val > tmpmax) {
                    tmpmax = val;
                    idx=j;
                }
            }
            Rabbithorse[idx].cnt++;
            max = tmpmax;
        }     
        for(int i=0; i<10; i++) {
            for(int j=0; j<Rabbithorse[i].cnt; j++) {
                printf("%c", Rabbithorse[i].c);
            }
        }
    }
}

Intégrer sur un site web

Pour intégrer ce projet à votre site web, copiez le code suivant et collez-le dans le HTML de votre site web :