結果
問題 |
No.254 文字列の構成
|
ユーザー |
![]() |
提出日時 | 2015-07-25 00:52:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 655 bytes |
コンパイル時間 | 580 ms |
コンパイル使用メモリ | 73,740 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-16 04:10:28 |
合計ジャッジ時間 | 4,675 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 2 WA * 28 |
ソースコード
#include <iostream> #include <vector> #include <cstdio> #include <sstream> #include <map> #include <string> #include <algorithm> #include <queue> #include <cmath> #include <set> using namespace std; int main(){ int n; cin >> n; long long lb = 0; long long ub = 100000; while(ub-lb > 1){ long long mid = (lb+ub)/2; if( n > (mid)*(mid+1)/2){ lb = mid; }else{ ub = mid; } } long long aaaa = lb; string ans(aaaa, 'a'); long long rem = n - ((aaaa)*(aaaa+1))/2; //cerr << aaaa << " " << (aaaa*(aaaa+1))/2 << endl; //cerr << rem << endl; for(int i=0; i<rem; i++){ ans.push_back('c' + i%20); } cout << ans << endl; return 0; }