結果

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

ソースコード

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 + 6) / 2 + 1 <= n) {
        k++;
    }
    ll cnt = k * (k + 5) / 2 + 1;
    for (int i = 0; i < k; i++) {
        cout << "ab";
    }
    cout << "a";
    for (ll i = cnt; i < n; i++) {
        cout << "c";
        i++;
        if (i < n) {
            cout << "d";
            i++;
        }
        if (i < n) {
            cout << "e";
            i++;
        }
    }
    return 0;
}
0