結果
| 問題 |
No.1010 折って重ねて
|
| コンテスト | |
| ユーザー |
leafirby
|
| 提出日時 | 2019-11-01 18:22:25 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,270 bytes |
| コンパイル時間 | 1,821 ms |
| コンパイル使用メモリ | 171,848 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-16 00:17:14 |
| 合計ジャッジ時間 | 2,956 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 43 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 99999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(150) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int attack(int A,int B){
if(!A||!B)return -1;
else return (A+B)%5;
}
pint marge(int A,int B,bool C){
int P=A+B;
if(C&&P<4||C&&P==5||P==0)return pint(-1,-1);
else{
if(!C&&P>5)P%=5;
if(!C){
if(P==1)A=1;
else if(P==2)if(A==1)A=2;else A=1;
else if(P==3)if(A==0||A==3)A=2;else A=3;
else if(P==4)if(A==2||A%2==1)A=4;else A=2;
else if(P==5)if(A==2||A==3)A=4;else A=3;
}else{
if(P==4)if(A%2==0)A=3;else A=2;
else if(P==6)if(A%2==0)A=3;else A=4;
else if(P==7)A=P=2;
else if(P==8){A=2;P=3;}
}
return pint(A,P-A);
}
}
tuple<int,int,int,int> solve(int L1,int R1,int L2,int R2,int E,int flag){
if(!E)if(!flag)L2=attack(L1,L2);else L1=attack(L1,L2);
else if(E==1)if(!flag)R2=attack(L1,R2);else L1=attack(L1,R2);
else if(E==2)if(!flag)L2=attack(R1,L2);else R1=attack(R1,L2);
else if(E==3)if(!flag)R2=attack(R1,R2);else R1=attack(R1,R2);
else if(E==4)if(!flag)pint(L1,L2)=marge(L1,L2,0);else pint(R1,R2)=marge(R1,R2,0);
else if(E==5)if(!flag)pint(L1,L2)=marge(L1,L2,1);else pint(R1,R2)=marge(R1,R2,1);
return make_tuple(L1,R1,L2,R2);
}
int main(){
lli A,B,C,D,E,F,N,M,K,L,R,X,Y,H,W,sum=0,num=0,flag=0;string S,T;
cin >> X >> Y >> H;
long double x=1000*X,y=1000*Y;
while(x>H||y>H){
if(x>y)if(y>H)y/=2;else x/=2;
else if(y>=x)if(x>H)x/=2;else y/=2;
sum++;
H*=2;
}
Out(sum);
}
leafirby