답안 #40885

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40885 2018-02-09T17:09:36 Z cdjs1432 쌍둥이 독수리 (GA7_twineagles) C
0 / 100
500 ms 496 KB
#include <stdio.h>
#include <stdlib.h>

int main()
{
    int LH,S,D;
    int tempS,tempD;
    int L,B;
    int atk=2;
    long long day1=0,day2=0;
    scanf("%d %d %d %d %d",&LH,&S,&D,&L,&B);
    tempS=S,tempD=D;

    while (D>0||S>0)
    {
        day1++;
        atk=2;
        if (S>2*LH)
            S-=2*LH;
        else if (S>0)
            S-=LH,D-=LH;
        else
            D-=LH*2;
        if (S>0)
            S+=L;
        if (D>0)
            D+=B;
    }
    S=tempS,D=tempD;
    while (D>0||S>0)
    {
        day2++;
        atk=2;
        if (D>2*LH)
            D-=2*LH;
        else if (D>0)
            D-=LH,S-=LH;
        else
            S-=LH*2;
        if (S>0)
            S+=L;
        if (D>0)
            D+=B;
    }
    printf("%lld",(day2<day1)?day2:day1);
}

Compilation message

twineagles.c: In function 'main':
twineagles.c:9:9: warning: variable 'atk' set but not used [-Wunused-but-set-variable]
     int atk=2;
         ^
twineagles.c:11: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);
     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 17 ms 248 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
3 Correct 5 ms 424 KB Output is correct
4 Correct 20 ms 424 KB Output is correct
5 Execution timed out 1080 ms 496 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1073 ms 496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1074 ms 496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1067 ms 496 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1083 ms 496 KB Time limit exceeded
2 Halted 0 ms 0 KB -