Submission #6610

#TimeUsernameProblemLanguageResultExecution timeMemory
6610Qwaz없는 등수 찾기 (GA7_rank)C++98
0 / 100
0 ms1088 KiB
#include <cstdio> #include <algorithm> using namespace std; typedef long long ll; const ll INF = 1234567890LL; ll attack, sa, sb, ra, rb; void solve(){ ll res = INF * INF; int i; for(i = 0; i<2; i++){ ll t = 2*attack - ra; ll day = max((sa-ra-1)/t, 0LL); ll remain = sb + rb*day; if(sa + ra*day <= 2*attack*(day+1) - attack) remain -= attack; if(remain > 0){ day++; remain += rb; day += (remain-rb-1)/(2*attack-rb); } res = min(res, day); swap(sa, sb); swap(ra, rb); } printf("%lld\n", res+1); } int main(){ scanf("%d%d%d%d%d", &attack, &sa, &sb, &ra, &rb); solve(); 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...