結果

問題 No.3 ビットすごろく
コンテスト
ユーザー subsn
提出日時 2023-06-09 11:54:59
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
TLE  
実行時間 -
コード長 758 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 185 ms
コンパイル使用メモリ 41,540 KB
最終ジャッジ日時 2026-02-22 10:44:37
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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