Submission #6029

#TimeUsernameProblemLanguageResultExecution timeMemory
6029kriii쌍둥이 독수리 (GA7_twineagles)C++98
100 / 100
0 ms1088 KiB
#include <stdio.h> long long day(long long e, long long d, long long s) { if (e <= s) return 1; return (e - d - 1) / (s - d) + 1; } long long min(long long a, long long b) { return a < b ? a : b; } int main() { long long s,e[2],d[2]; scanf ("%lld %lld %lld %lld %lld",&s,e,e+1,d,d+1); long long ans = 1ll<<62; for (int k=0;k<2;k++){ long long a = day(e[k],d[k],s*2) - 1; if (e[k] + (d[k] - s * 2) * a <= s){ if (e[!k] + d[!k] * a <= s) a++; else a += day(e[!k]+d[!k]*(a+1)-s,d[!k],s*2) + 1; } else a += day(e[!k]+d[!k]*(a+1),d[!k],s*2)+1; ans = min(ans,a); } printf ("%lld\n",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...