Submission #40884

# Submission time Handle Problem Language Result Execution time Memory
40884 2018-02-09T17:08:43 Z cdjs1432 쌍둥이 독수리 (GA7_twineagles) C
11 / 100
2 ms 756 KB
#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

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
1 Correct 2 ms 248 KB Output is correct
2 Correct 1 ms 360 KB Output is correct
3 Correct 1 ms 592 KB Output is correct
4 Correct 2 ms 592 KB Output is correct
5 Correct 1 ms 592 KB Output is correct
6 Correct 1 ms 592 KB Output is correct
7 Correct 2 ms 660 KB Output is correct
8 Correct 1 ms 692 KB Output is correct
9 Correct 1 ms 692 KB Output is correct
10 Correct 2 ms 692 KB Output is correct
11 Correct 2 ms 692 KB Output is correct
12 Correct 1 ms 692 KB Output is correct
13 Correct 2 ms 692 KB Output is correct
14 Correct 1 ms 728 KB Output is correct
15 Correct 1 ms 728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 728 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 756 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 756 KB Output isn't correct
2 Halted 0 ms 0 KB -