結果

問題 No.3 ビットすごろく
ユーザー subsnsubsn
提出日時 2023-06-09 11:54:59
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 758 bytes
コンパイル時間 681 ms
コンパイル使用メモリ 29,496 KB
実行使用メモリ 5,980 KB
最終ジャッジ日時 2023-08-30 07:17:58
合計ジャッジ時間 13,033 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <math.h>

/// <summary>
/// 入力された数字を返す
/// </summary>
/// <returns></returns>
int ReadNum() {
	int negate = 0;
	char c = getchar();
	int num = 0;
	int numCnt = 0;
	while (c != '\n') {
		if (c == '-') {
			negate = 1;
		}
		else {
			num = num * 10 + c - '0';
		}

		c = getchar();
	}
	if (negate == 1) {
		num *= -1;
	}
	return num;
}

int main()
{
	int bits[14] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
	int n = ReadNum();
	int now = 1;
	int work = now;

	while (1) {
		int cnt = 0;
		for (int i = 13;i >= 0;i--) {
			if (i == 1) {
				bits[13] = work / 1;
				continue;
			}
			bits[14 - i - 1] = work / pow(2, i);
			work %= (int)pow(2, i);
		}
		for (int i = 0;i < 14;i++) {
			if (bits[i] == 1) cnt++;
		}

	}
}
0