結果

問題 No.2198 Concon Substrings (COuNt-CONstruct Version)
ユーザー vjudge1
提出日時 2025-07-05 17:56:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 546 bytes
コンパイル時間 4,611 ms
コンパイル使用メモリ 191,428 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-05 17:56:54
合計ジャッジ時間 6,612 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 104
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
string s(60005, ' ');
int cnt[20005], maxx = -1;
int main(){
  long long m;
  cin >> m;
  if (!m){
    cout << "c";
    return 0;
  }
  for (int i = 0; i < 40000; i += 2){
    s[i] = 'c', s[i + 1] = 'o';
  }
  for (int i = 20000 - 1; i >= 1; i--){
    while (i * (i + 1) / 2 <= m){
      cnt[i - 1]++;
      maxx = max(maxx, i);
      m -= i * (i + 1) / 2;
    }
  }
  for (int i = 0; i < maxx; i++){
    cout << "co";
    for (int j = 1; j <= cnt[i]; j++){
      cout << 'n';
    }
  }
  return 0;
}
0