結果
問題 | No.294 SuperFizzBuzz |
ユーザー |
![]() |
提出日時 | 2017-05-06 15:24:43 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 310 ms / 5,000 ms |
コード長 | 856 bytes |
コンパイル時間 | 718 ms |
コンパイル使用メモリ | 22,144 KB |
実行使用メモリ | 339,016 KB |
最終ジャッジ日時 | 2024-09-14 13:54:54 |
合計ジャッジ時間 | 5,372 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:7:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d",&n); | ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> void run(void){ const int len=25; int n; scanf("%d",&n); int *now=(int *)malloc(sizeof(int)*(1<<(len+1))); int *next=(int *)malloc(sizeof(int)*(1<<(len+1))); now[0]=3; now[1]=5; int count=0; int i; for(i=1;i<=len;i++){ int j; for(j=0;j<(1<<i);j++){ if(now[j]%3==0 && (j&0x01)){ count++; if(n==count){ int k=i-1; while(k>=0){ if((j>>k)&0x01){ printf("5"); } else { printf("3"); } k--; } printf("\n"); j=(1<<i)-1; i=len; } } next[2*j+0]=now[j]+3; next[2*j+1]=now[j]+5; } int *swap=now; now=next; next=swap; } free(now); free(next); return; } int main(void){ run(); return 0; }