結果

問題 No.294 SuperFizzBuzz
ユーザー FF256grhyFF256grhy
提出日時 2015-10-24 00:24:04
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 612 ms / 5,000 ms
コード長 538 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 26,876 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-11 05:05:36
合計ジャッジ時間 4,686 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

int n;

int bc(int, int);

int main(void) {
	scanf("%d", &n);
	int l, m, c = 0, flag = 0;
	for(l = 3; l <= 25; l++) {
	for(m = 1; m < (1 << l); m += 2) {
		if( bc(m, l) % 3 == 0 ) { c++; }
		if(c == n) { flag = 1; break; }
	} if(flag) { break; }
	}
	
	int i, d[25];
	for(i = 0; i < l; i++) {
		d[i] = m % 2;
		m /= 2;
	}
	for(i = l - 1; 0 <= i; i--) {
		printf(d[i] ? "5" : "3");
	}
	printf("\n");
	
	return 0;
}

int bc(int m, int l) {
	int i, c = 0;
	for(i = 0; i < l; i++) {
		c += m % 2;
		m /= 2;
	}
	return c;
}
0