Submission #40884

#TimeUsernameProblemLanguageResultExecution timeMemory
40884cdjs1432쌍둥이 독수리 (GA7_twineagles)C11
11 / 100
2 ms756 KiB
#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); }

Compilation message (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 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...