結果
| 問題 |
No.294 SuperFizzBuzz
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-06-08 21:26:14 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 153 ms / 5,000 ms |
| コード長 | 649 bytes |
| コンパイル時間 | 988 ms |
| コンパイル使用メモリ | 60,824 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 03:22:58 |
| 合計ジャッジ時間 | 3,002 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
| 外部呼び出し有り |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:40:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
40 | system("pause");
| ~~~~~~^~~~~~~~~
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <ciso646>
#include <bitset>
using namespace std;
#define ull unsigned long long
int main(void) {
int N; cin >> N;
int M = 32;
int count = 0;
ull res;
int m;
for (m = 1; m < M; ++m) {
unsigned long long u = 0;
for (ull i = 0; i < (1 << (m-1)); ++i) {
ull tar = i << 1; tar += 1;
if (bitset<36>(tar).count() % 3 == 0) ++count;
if (count == N) {
res = tar;
break;
}
}
if (count == N) break;
}
bitset<36> b = res;
for (int i = m-1; i >= 0; --i) {
cout << (b[i] ? 5 : 3);
}
cout << endl;
system("pause");
return 0;
}