結果

問題 No.254 文字列の構成
ユーザー 🍮かんプリン
提出日時 2020-05-25 00:57:02
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 590 bytes
コンパイル時間 1,294 ms
コンパイル使用メモリ 157,900 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 14:29:02
合計ジャッジ時間 6,372 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 1 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.05.25 00:56:58
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n;cin >> n;
    ll k = 0;
    while((k + 1) * (k + 2) / 2 <= n) {
        k++;
    }
    ll cnt = k * (k + 1) / 2;
    for (int i = 0; i < k; i++) {
        cout << "a";
    }
    for (ll i = cnt; i < n; i++) {
        cout << "b";
        i++;
        if (i < n) {
            cout << "c";
            i++;
        }
        if (i < n) {
            cout << "d";
            i++;
        }
    }
    return 0;
}
0