結果
| 問題 |
No.254 文字列の構成
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-03-01 23:01:32 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 507 bytes |
| コンパイル時間 | 535 ms |
| コンパイル使用メモリ | 60,044 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-24 13:17:04 |
| 合計ジャッジ時間 | 5,228 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 1 WA * 29 |
ソースコード
#include <iostream>
#include <vector>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
typedef long long ll;
using namespace std;
ll sumto(ll i) { return i * (i+1) / 2; }
int main() {
ll n; cin >> n;
vector<int> ans;
while (n > 0) {
ll i = 1;
while (sumto(i+1) <= n) ++ i;
ans.push_back(i);
n -= sumto(i);
}
repeat (i,ans.size()) {
repeat (j,ans[i]) {
cout << char((i%26) + 'a');
}
}
cout << endl;
return 0;
}