結果

問題 No.294 SuperFizzBuzz
ユーザー 夜
提出日時 2020-11-30 20:04:03
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4,720 ms / 5,000 ms
コード長 737 bytes
コンパイル時間 760 ms
コンパイル使用メモリ 92,576 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 03:01:09
合計ジャッジ時間 30,120 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,352 KB
testcase_01 AC 2 ms
4,356 KB
testcase_02 AC 4,720 ms
4,348 KB
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 2 ms
4,352 KB
testcase_05 AC 1 ms
4,352 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 244 ms
4,348 KB
testcase_09 AC 2,581 ms
4,348 KB
testcase_10 AC 2,575 ms
4,352 KB
testcase_11 AC 4,306 ms
4,348 KB
testcase_12 AC 4,446 ms
4,348 KB
testcase_13 AC 4,611 ms
4,348 KB
testcase_14 AC 4,667 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
	int n;
	cin >> n;
	int ans = 0;
	for (int i = 2; i <= 24; i++) {
		for (int bit = 0; bit < (1 << i); bit++) {
			string s = "";
			int co = 0;
			for (int j = 0; j < i; j++) {
				if (bit & (1 << j)) {
					co++;
					s += '5';
				}
				else{
					s += '3';
				}
			}
			co++;
			reverse(s.begin(), s.end());
			s += '5';
			if (co % 3 == 0) {
				ans++;
				if (ans == n) {
					cout << s << endl;
					return 0;
				}
			}
		}
	}
}
0