이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <stdlib.h>
int check(int health,int heal,int deal,long long hit)
{
if (health%deal==0)
hit+=health/deal;
else
hit+=health/deal,hit++;
health+=(hit-1)/2*heal;
health-=hit*deal;
if (health>0)
{
health+=heal;
return check(health,heal,deal,hit);
}
else
return hit;
}
int main()
{
int LH,D,S,L,B;
int temp1,temp2;
long long hit=0;
long long day1=0,day2=0;
scanf("%d %d %d %d %d",&LH,&S,&D,&L,&B);
temp1=S,temp2=D;
hit=check(S,L,LH,0);
if (hit%2==0)
day1=hit/2;
else
{
day1=hit/2+1;
D-=LH;
}
if (D>0)
{
D+=day1*B;
hit=check(D,B,LH,0);
day1+=(hit+1)/2;
}
S=temp1,D=temp2;
hit=check(D,B,LH,0);
if (hit%2==0)
day2=hit/2;
else
{
day2=hit/2+1;
D-=LH;
}
if (S>0)
{
S+=day1*L;
hit=check(S,L,LH,0);
day2+=(hit+1)/2;
}
printf("%lld",(day2<day1)?day2:day1);
}
컴파일 시 표준 에러 (stderr) 메시지
twineagles.c: In function 'main':
twineagles.c:27:5: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d %d %d %d %d",&LH,&S,&D,&L,&B);
^
# | 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... |