結果
問題 | No.254 文字列の構成 |
ユーザー |
![]() |
提出日時 | 2019-07-10 20:52:39 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 593 bytes |
コンパイル時間 | 1,224 ms |
コンパイル使用メモリ | 30,976 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-06 07:16:07 |
合計ジャッジ時間 | 2,049 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
コンパイルメッセージ
main.c: In function 'in': main.c:8:14: warning: implicit declaration of function 'getchar_unlocked' [-Wimplicit-function-declaration] 8 | #define gc() getchar_unlocked() | ^~~~~~~~~~~~~~~~ main.c:17:24: note: in expansion of macro 'gc' 17 | int n = 0, c = gc(); | ^~ main.c: In function 'calc': main.c:9:15: warning: implicit declaration of function 'putchar_unlocked' [-Wimplicit-function-declaration] 9 | #define pc(c) putchar_unlocked(c) | ^~~~~~~~~~~~~~~~ main.c:25:9: note: in expansion of macro 'pc' 25 | pc(a); while (--k) pc(b), pc(a); | ^~
ソースコード
// 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)#endifint 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;}