結果

問題 No.294 SuperFizzBuzz
ユーザー kurenaifkurenaif
提出日時 2016-06-08 21:26:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 118 ms / 5,000 ms
コード長 649 bytes
コンパイル時間 845 ms
コンパイル使用メモリ 62,100 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-07-30 08:40:44
合計ジャッジ時間 2,299 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
外部呼び出し有り
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,380 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 118 ms
4,376 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 4 ms
4,376 KB
testcase_06 AC 4 ms
4,376 KB
testcase_07 AC 4 ms
4,380 KB
testcase_08 AC 10 ms
4,376 KB
testcase_09 AC 68 ms
4,380 KB
testcase_10 AC 66 ms
4,376 KB
testcase_11 AC 107 ms
4,376 KB
testcase_12 AC 113 ms
4,376 KB
testcase_13 AC 114 ms
4,376 KB
testcase_14 AC 117 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0