結果

問題 No.420 mod2漸化式
ユーザー olpheolphe
提出日時 2016-11-18 21:49:17
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 606 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 51,432 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-02 08:43:38
合計ジャッジ時間 14,268 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 TLE -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 7 ms
4,380 KB
testcase_09 AC 21 ms
4,376 KB
testcase_10 AC 57 ms
4,376 KB
testcase_11 AC 138 ms
4,376 KB
testcase_12 AC 284 ms
4,376 KB
testcase_13 AC 512 ms
4,380 KB
testcase_14 AC 810 ms
4,380 KB
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 873 ms
4,376 KB
testcase_21 AC 567 ms
4,376 KB
testcase_22 AC 322 ms
4,380 KB
testcase_23 AC 160 ms
4,376 KB
testcase_24 AC 70 ms
4,380 KB
testcase_25 AC 27 ms
4,380 KB
testcase_26 AC 10 ms
4,380 KB
testcase_27 AC 4 ms
4,376 KB
testcase_28 AC 2 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "iostream"
using namespace std;

const long long int UP = 2147483647;
int N;
long long int ans;
int fig;

void search(long long int num,int point ,int cap) {
	if (num > UP)return ;
	if (num == 0) {
		search(1, 1,30);
		if (N == 0) {
			fig++;
		}
		return ;
	}
	if (point < N) {
		if(cap-1+point>=N)search(num * 2, point,cap-1);

		if(cap+point)search(num * 2 + 1, point + 1,cap-1);
	}
	else if (point == N) {
		for (int i = cap; i >= 0; i--) {
			ans += num;
			num *= 2;
		}
		fig+=cap+1;
	}
	return ;
}

int main() {
	cin >> N;
	search(0, 0,31);
	cout << fig << " " << ans << "\n";
	return 0;
}
0