結果

問題 No.294 SuperFizzBuzz
ユーザー kurenaifkurenaif
提出日時 2016-06-08 21:26:14
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 137 ms / 5,000 ms
コード長 649 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 61,008 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 09:55:50
合計ジャッジ時間 1,902 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 137 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 10 ms
5,376 KB
testcase_09 AC 79 ms
5,376 KB
testcase_10 AC 78 ms
5,376 KB
testcase_11 AC 128 ms
5,376 KB
testcase_12 AC 132 ms
5,376 KB
testcase_13 AC 135 ms
5,376 KB
testcase_14 AC 137 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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");
      |         ~~~~~~^~~~~~~~~

ソースコード

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