結果

問題 No.294 SuperFizzBuzz
ユーザー FF256grhyFF256grhy
提出日時 2015-10-23 23:42:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 523 bytes
コンパイル時間 856 ms
コンパイル使用メモリ 26,300 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-10-01 01:34:41
合計ジャッジ時間 4,479 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>

// WA

int n;

int bc(int);
void print(int);

int main(void) {
	scanf("%d", &n);
	int m, c = 0;
	for(m = 1; ; m += 2) {
		if( bc(m) % 3 == 0 ) { c++; }
		if(n == c) { break; }
	}
	print(m);
	return 0;
}

int bc(int a) {
	int c = 0;
	while(a != 0) {
		c += a % 2;
		a /= 2;
	}
	return c;
}

void print(int m) {
	int d[32], i;
	for(i = 0; i < 32; i++) {
		d[i] = m % 2;
		m /= 2;
	}
	int flag = 0;
	for(i = 31; 0 <= i; i--) {
		if(flag || d[i]) { flag = 1; printf(d[i] ? "5" : "3"); }
	}
	printf("\n");
}
0