이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
int main()
{
FILE *in=fopen("input.txt","r");
FILE *out=fopen("output.txt","w");
int i,j,a,h1,h2,c1,c2,t=0,d1=0,d2=0,cnt=0;
fscanf(in,"%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)
{
fprintf(out,"%d",cnt);
return 0;
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |