結果

問題 No.254 文字列の構成
ユーザー k
提出日時 2020-06-12 08:34:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 377 bytes
コンパイル時間 2,045 ms
コンパイル使用メモリ 193,496 KB
最終ジャッジ日時 2025-01-11 01:40:28
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 1 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  cin >> n;

  int x = 1;
  while (x + 1 + (x+1) * x / 2 <= n) ++x;

  n -= x + x * (x-1) / 2;
  string ret(x, 'a');
  string t = "bcdef";
  REP (i, n)
    ret += t[i%5];

  cout << ret << endl;
  
  return 0;
}
0