結果
| 問題 |
No.642 Two Operations No.1
|
| コンテスト | |
| ユーザー |
tecchaxn
|
| 提出日時 | 2018-02-02 21:41:29 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 742 bytes |
| コンパイル時間 | 1,415 ms |
| コンパイル使用メモリ | 162,832 KB |
| 実行使用メモリ | 814,684 KB |
| 最終ジャッジ日時 | 2024-12-31 07:20:03 |
| 合計ジャッジ時間 | 19,196 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 TLE * 5 |
ソースコード
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef pair<int,int> P;
//-----------------------------------------------------------------------
const int INF=1e18;
signed main()
{
cin.tie(0);
ios::sync_with_stdio(false);
int n; cin>>n;
queue<int> que;
que.push(n);
int ans=0;
while(!que.empty()){
int sz=que.size();
REP(i,sz){
int x=que.front(); que.pop();
if(x==1){
cout<<ans<<endl;
return 0;
}else{
que.push(x+1);
if(x%2==0) que.push(x/2);
}
}
ans++;
}
}
tecchaxn