Submission #6322

#TimeUsernameProblemLanguageResultExecution timeMemory
6322jhs7jhs쌍둥이 독수리 (GA7_twineagles)C++98
100 / 100
0 ms1088 KiB
#include<stdio.h> long long f(long long a,long long b,long long c, long long d,long long e){ long long ans = 0,t; if(2*a>=b){ if(a>=b){ if(a>=c){ return 1; } else{ c += (e-a); } } else{ c += e; } ans = 1; } else{ t = (b-d-1) / (2*a-d); ans += t+1, c += t*e; if( b-(2*a-d)*t <= a){ if(a >= c){ return ans; } else{ c += (e-a); } } else{ c += e; } } if(2*a>=c){ return ans+1; } else{ if(2*a<e) return -1; t = (c-e-1) / (2*a-e); return ans + t + 1; } } int main() { long long a,b,c,d,e; long long ans=0, ans2=0; scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e); ans = f(a,b,c,d,e); ans2 = f(a,c,b,e,d); if(ans == -1) printf("%lld\n",ans2); else if(ans2 == -1) printf("%lld\n",ans); else printf("%lld\n",((ans>ans2)?ans2:ans)); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...