Submission #6021

#TimeUsernameProblemLanguageResultExecution timeMemory
6021model_code쌍둥이 독수리 (GA7_twineagles)C++98
29 / 100
0 ms1088 KiB
#include<stdio.h> typedef long long lld; lld lh, s, d, l, b, d1, d2; lld defeat(lld fhp, lld fhe, lld shp, lld she){ long long sum=0; if(fhp<=lh && shp<=lh)return 1; if(fhp > lh*2){ sum += (fhp-2*lh)/(2*lh-fhe), fhp -= sum*(2*lh-fhe), shp += sum*she; } if(fhp > lh*2){ fhp -= 2*lh-fhe, shp += she, sum++; if(fhp <= lh)shp -= lh; } sum++, shp += she; // defeat first animal if(shp > lh*2){ sum += (shp-2*lh)/(2*lh-she), shp = (shp-2*lh)%(2*lh-she)+2*lh; } if(shp > lh*2)sum+=2; else sum++; // defeat second animal return sum; } int main(){ scanf("%lld%lld%lld%lld%lld", &lh, &s, &d, &l, &b); if(b > 0) return 0; d1 = defeat(s, l, d, b); d2 = defeat(d, b, s, l); if(d1<d2)printf("%lld", d1); else printf("%lld", d2); 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...