結果
問題 |
No.294 SuperFizzBuzz
|
ユーザー |
![]() |
提出日時 | 2017-05-07 01:08:51 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 125 ms / 5,000 ms |
コード長 | 655 bytes |
コンパイル時間 | 668 ms |
コンパイル使用メモリ | 21,760 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 14:06:08 |
合計ジャッジ時間 | 1,648 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
main.c: In function ‘run’: main.c:15:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d",&n); | ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h> #include<stdlib.h> int popCount(int n){ int t=(n&0x55555555)+((n>>1)&0x55555555); t=(t&0x33333333)+((t>>2)&0x33333333); t=(t&0x0F0F0F0F)+((t>>4)&0x0F0F0F0F); t=(t&0x00FF00FF)+((t>>8)&0x00FF00FF); t=(t&0x0000FFFF)+((t>>16)&0x0000FFFF); return t; } void run(void){ int n; scanf("%d",&n); int i,j; for(i=3;i<=25;i++){ for(j=0;j<(1<<(i-1));j++){ n-=(__builtin_popcount(j)%3==2); if(n==0){ int k=i-2; while(k>=0){ printf("%d",(j>>k)&0x01?5:3); k--; } printf("5\n"); return; } } } return; } int main(void){ run(); return 0; }