結果

問題 No.294 SuperFizzBuzz
ユーザー naimonon77naimonon77
提出日時 2016-07-24 14:16:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,129 bytes
コンパイル時間 1,773 ms
コンパイル使用メモリ 165,636 KB
実行使用メモリ 81,536 KB
最終ジャッジ日時 2024-04-24 08:28:01
合計ジャッジ時間 4,408 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
81,408 KB
testcase_01 AC 56 ms
81,280 KB
testcase_02 WA -
testcase_03 AC 60 ms
81,408 KB
testcase_04 AC 59 ms
81,280 KB
testcase_05 AC 56 ms
81,280 KB
testcase_06 AC 58 ms
81,536 KB
testcase_07 AC 61 ms
81,408 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
bool test = 0;
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

/* pow(x,n)はx^nを返すよ! */
template<class T>
T pow(T x, T n) {
	T res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}

vector<ull> v((int)1e7);

signed main(void)
{
	ull i, j, k, l;
	ull N;
	int vsize = 0;
	cin >> N;
	REP(i, 3, 19) {
		rep(j, (ull)1 << i) {
			int a = j;
			string s;
			rep(k, i) {
				if (a & 1) s += "5";
				else s += "3";
				a >>= 1;
			}
			reverse(ALL(s));
			ull b = stoull(s);
			if (b % 3 == 0 && b % 5 == 0) {
				v[vsize++] = b;
			}
			if (vsize == N) goto end;
		}
	}
end:
	cout << v[N-1] << endl;
	return 0;
}
0