結果
| 問題 |
No.254 文字列の構成
|
| ユーザー |
drken1215
|
| 提出日時 | 2024-04-26 22:32:15 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 529 bytes |
| コンパイル時間 | 2,001 ms |
| コンパイル使用メモリ | 194,624 KB |
| 最終ジャッジ日時 | 2025-02-21 09:11:11 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | AC * 1 WA * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
const long long MAX = 100000;
int main() {
string res = "";
char letter = 'a';
long long N;
cin >> N;
while (N > 0) {
long long low = 0, high = MAX;
while (high - low > 1) {
long long x = (low + high) / 2;
if (x * (x + 1) / 2 <= N) low = x;
else high = x;
}
for (int i = 0; i < low; ++i) res += letter;
N -= low * (low + 1) / 2;
++letter;
}
cout << res << endl;
}
drken1215