#include <stdio.h>
int main()
{
int i,j,a,h1,h2,c1,c2,t=0,d1=0,d2=0,cnt=0;
scanf("%d %d %d %d %d",&a,&h1,&h2,&c1,&c2);
if(c1>=c2) t=1;
else t=2;
for(i=1;; i++)
{
/**1¹ø **/
if(t==1 && d1!=1)
{
h1-=a;
if(h1<=0)
{
d1=1;
t=2;
}
}
/**2¹ø **/
if(t==2 && d2!=1)
{
h2-=a;
if(h2<=0)
{
d2=1;
t=1;
}
}
/**1¹ø **/
if(t==1 && d1!=1)
{
h1-=a;
if(h1<=0)
{
d1=1;
t=2;
}
}
/**2¹ø **/
if(t==2 && d2!=1)
{
h2-=a;
if(h2<=0)
{
d2=1;
t=1;
}
}
cnt++;
if(d1==1 && d2==1)
{
printf("%d",cnt);
return 0;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
8 ms |
1088 KB |
Output is correct |
2 |
Correct |
0 ms |
1088 KB |
Output is correct |
3 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
4 |
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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
1088 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |