#include<stdio.h>
long long int swap(long long int &a,long long int &b){
long long int c;
c=a;
a=b;
b=c;
}
int main(){
long long int lh,s,e,l,b;
long long int cnt;
long long int k;
scanf("%lld%lld%lld%lld%lld",&lh,&s,&e,&l,&b);
if(l<b){
swap(l,b);
swap(s,e);
}
//l>=b
k=lh*2-l;
if(s%k>l){
cnt=s/k;
e+=cnt*b;
s=s%k;
if(s==0){
}
else if(s<=lh){
s=0;
e-=lh;
cnt++;
if(e>=0)
e+=b;
}
else{
s=0;
e+=b;
cnt++;
}
}
else{
cnt=s/k;
e+=cnt*b;
s=0;
}
k=lh*2-b;
if(e%k>b){
cnt+=e/k+1;
}
else{
cnt+=e/k;
}
printf("%lld",cnt);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Correct |
0 ms |
1088 KB |
Output is correct |
4 |
Correct |
0 ms |
1088 KB |
Output is correct |
5 |
Correct |
0 ms |
1088 KB |
Output is correct |
6 |
Correct |
0 ms |
1088 KB |
Output is correct |
7 |
Correct |
0 ms |
1088 KB |
Output is correct |
8 |
Correct |
0 ms |
1088 KB |
Output is correct |
9 |
Correct |
0 ms |
1088 KB |
Output is correct |
10 |
Correct |
0 ms |
1088 KB |
Output is correct |
11 |
Correct |
0 ms |
1088 KB |
Output is correct |
12 |
Correct |
0 ms |
1088 KB |
Output is correct |
13 |
Correct |
0 ms |
1088 KB |
Output is correct |
14 |
Correct |
0 ms |
1088 KB |
Output is correct |
15 |
Correct |
0 ms |
1088 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |