結果

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

ソースコード

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 / 2 + 1 <= n) ++x;

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

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