結果

問題 No.420 mod2漸化式
ユーザー kurenai3110
提出日時 2016-09-09 23:23:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
実行時間 -
コード長 620 bytes
コンパイル時間 705 ms
コンパイル使用メモリ 78,112 KB
実行使用メモリ 766,256 KB
最終ジャッジ日時 2024-11-16 18:38:44
合計ジャッジ時間 54,723 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 5 WA * 1 TLE * 5 MLE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <queue>
using namespace std;

int main()
{
	int x;
	long long sum = 0,cnt=0;
	cin >> x;
	queue<pair<int,int> > que;
	que.push(make_pair(1,1));

	while (que.size()!=0) {
		long long a, b;
		pair<long long, int> pr;
		pr = que.front();
		que.pop();
		if (pr.second == x) {
			sum += pr.first;
			cnt++;
		}
		a = pr.first * 2;
		b = pr.first * 2 + 1;
		if (a < INT32_MAX) que.push(make_pair(a, pr.second));
		if (b < INT32_MAX && pr.second < x)que.push(make_pair(b, pr.second + 1));
	}

	cout << cnt << " " << sum << endl;

    return 0;
}
0