結果

問題 No.420 mod2漸化式
ユーザー kurenai3110
提出日時 2016-10-31 14:52:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
実行時間 -
コード長 541 bytes
コンパイル時間 519 ms
コンパイル使用メモリ 70,664 KB
実行使用メモリ 823,772 KB
最終ジャッジ日時 2024-11-25 00:04:43
合計ジャッジ時間 55,864 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 1
other AC * 8 WA * 1 TLE * 25 MLE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <queue>
#include <map>
using namespace std;

int main() {
	int x;cin>>x;
	int cnt=0;
	long long ans=0;
	queue<pair<long long ,long long>>que;
	que.push(make_pair(1,1));
	while(!que.empty()){
		pair<long long,long long> p;
		p = que.front();que.pop();
		if(p.second==x){
			cnt++;
			ans+= p.first;
		}
		if(p.second<=x){
			if(p.first*2<=2147483647)que.push(make_pair(p.first*2,p.second));
			if(p.first*2+1<=2147483647)que.push(make_pair(p.first*2+1,p.second+1));
		}
	}
	cout<<cnt<<" "<<ans<<endl;
	return 0;
}
0