Submission #6763

#TimeUsernameProblemLanguageResultExecution timeMemory
6763cki86201쌍둥이 독수리 (GA7_twineagles)C++98
100 / 100
0 ms1088 KiB
#include<stdio.h> #include<algorithm> #include<string.h> #include<vector> #include<math.h> #include<stdlib.h> #include<set> #include<ctype.h> using namespace std; #define X first #define Y second typedef long long ll; typedef pair<int,int> Pi; ll solve(ll lh, ll s, ll d, ll l, ll b) { ll ans = 0; if(s <= lh)ans = 1, d -= lh; else if(s <= 2*lh)ans = 1; else{ s -= 2*lh; ans = 1; ll A = 2*lh - l; ll D = (s+A-1) / A; ans += D; s -= D * A; if(s+lh <= 0)d -= lh; } if(d <= 0)return ans; d += ans * b; if(d <= 2*lh)return ans+1; else{ d -= 2*lh; ans++; ll A = 2*lh - b; ans += (d+A-1) / A; } return ans; } int main() { ll lh, s, d, l, b; scanf("%lld%lld%lld%lld%lld",&lh,&s,&d,&l,&b); printf("%lld", min(solve(lh, s, d, l, b), solve(lh, d, s, b, l))); 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...