結果
問題 | No.254 文字列の構成 |
ユーザー |
![]() |
提出日時 | 2017-06-11 00:31:11 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 381 bytes |
コンパイル時間 | 92 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-24 15:47:32 |
合計ジャッジ時間 | 1,318 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:26:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d",&n); | ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> void calc(int n,char s){ if(n==0){ putchar('\n'); return; } int k=1; int t=1; while(t+k/2+1<=n){ t+=k/2+1; k++; } int i; for(i=0;i<k;i++){ putchar((char)(s+i%2)); } calc(n-t,s+2); return; } void run(void){ int n; scanf("%d",&n); calc(n,'a'); return; } int main(void){ run(); return 0; }