結果
問題 | No.294 SuperFizzBuzz |
ユーザー |
![]() |
提出日時 | 2019-03-25 01:17:29 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 165 ms / 5,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 545 ms |
コンパイル使用メモリ | 55,296 KB |
最終ジャッジ日時 | 2025-01-07 00:27:56 |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d", &N); | ~~~~~^~~~~~~~~~
ソースコード
#include <cstdio>#include <cstdint>#include <string>std::string nyan(int i, int j) {std::string res(i, '3');for (int k = 0; k < i; ++k)if (j >> k & 1)res[i-k-1] = '5';return res;}int main() {int N;scanf("%d", &N);for (int i = 3; true; ++i) {for (int j = 0; j < (1 << i); ++j) {if (!(j & 1)) continue;if (__builtin_popcount(j) % 3 != 0) continue;if (--N == 0)return !printf("%s\n", nyan(i, j).c_str());}}}