結果
問題 |
No.294 SuperFizzBuzz
|
ユーザー |
![]() |
提出日時 | 2015-10-23 23:42:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 523 bytes |
コンパイル時間 | 205 ms |
コンパイル使用メモリ | 23,168 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-23 19:07:38 |
合計ジャッジ時間 | 4,264 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | WA * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d", &n); | ~~~~~^~~~~~~~~~
ソースコード
#include <stdio.h> // WA int n; int bc(int); void print(int); int main(void) { scanf("%d", &n); int m, c = 0; for(m = 1; ; m += 2) { if( bc(m) % 3 == 0 ) { c++; } if(n == c) { break; } } print(m); return 0; } int bc(int a) { int c = 0; while(a != 0) { c += a % 2; a /= 2; } return c; } void print(int m) { int d[32], i; for(i = 0; i < 32; i++) { d[i] = m % 2; m /= 2; } int flag = 0; for(i = 31; 0 <= i; i--) { if(flag || d[i]) { flag = 1; printf(d[i] ? "5" : "3"); } } printf("\n"); }