結果
| 問題 | No.254 文字列の構成 |
| コンテスト | |
| ユーザー |
bal4u
|
| 提出日時 | 2019-07-10 20:52:39 |
| 言語 | C(gnu17) (gcc 15.2.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 593 bytes |
| 記録 | |
| コンパイル時間 | 266 ms |
| コンパイル使用メモリ | 42,052 KB |
| 最終ジャッジ日時 | 2026-02-22 03:50:47 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 |
ソースコード
// yukicoder: No.254 文字列の構成
// 2019.7.10 bal4u
#include <stdio.h>
#include <math.h>
#if 1
#define gc() getchar_unlocked()
#define pc(c) putchar_unlocked(c)
#else
#define gc() getchar()
#define pc(c) putchar(c)
#endif
int in() // 非負整数の入力
{
int n = 0, c = gc();
do n = 10 * n + (c & 0xf); while ((c = gc()) >= '0');
return n;
}
int calc(int n, int a, int b) {
int k = (int)sqrt((double)n);
n -= k*k;
pc(a); while (--k) pc(b), pc(a);
return n;
}
int main()
{
int a, N;
a = 'a', N = in();
while (N) N = calc(N, a, a+1), a += 2;
pc('\n');
return 0;
}
bal4u