Submission #6013

# Submission time Handle Problem Language Result Execution time Memory
6013 2014-06-15T16:37:23 Z model_code 쌍둥이 독수리 (GA7_twineagles) C++
29 / 100
0 ms 1088 KB
#include<stdio.h>
 
typedef long long lld;
 
lld lh, s, d, l, b, d1, d2;
 
lld defeat(lld fhp, lld fhe, lld shp, lld she){
    long long sum=0;
    if(fhp<=lh && shp<=lh)return 1;
    if(fhp > lh*2){
        sum += (fhp-2*lh)/(2*lh-fhe), fhp -= sum*(2*lh-fhe), shp += sum*she;
    }
    if(fhp > lh*2){
        fhp -= 2*lh-fhe, shp += she, sum++;
        if(fhp <= lh)shp -= lh;
    }
    sum++, shp += she; // defeat first animal
 
    if(shp > lh*2){
        sum += (shp-2*lh)/(2*lh-she), shp = (shp-2*lh)%(2*lh-she)+2*lh;
    }
    if(shp > lh*2)sum+=2;
    else sum++; // defeat second animal
    return sum;
}
 
int main(){
    scanf("%lld%lld%lld%lld%lld", &lh, &s, &d, &l, &b);
  if(b > 0) return 0;
    d1 = defeat(s, l, d, b);
    d2 = defeat(d, b, s, l);
    if(d1<d2)printf("%lld", d1);
    else printf("%lld", d2);
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
6 Correct 0 ms 1088 KB Output is correct
7 Correct 0 ms 1088 KB Output is correct
8 Correct 0 ms 1088 KB Output is correct
9 Correct 0 ms 1088 KB Output is correct
10 Correct 0 ms 1088 KB Output is correct
11 Correct 0 ms 1088 KB Output is correct
12 Correct 0 ms 1088 KB Output is correct
13 Correct 0 ms 1088 KB Output is correct
14 Correct 0 ms 1088 KB Output is correct
15 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
6 Correct 0 ms 1088 KB Output is correct
7 Correct 0 ms 1088 KB Output is correct
8 Correct 0 ms 1088 KB Output is correct
9 Correct 0 ms 1088 KB Output is correct
10 Correct 0 ms 1088 KB Output is correct
11 Correct 0 ms 1088 KB Output is correct
12 Correct 0 ms 1088 KB Output is correct
13 Correct 0 ms 1088 KB Output is correct
14 Correct 0 ms 1088 KB Output is correct
15 Correct 0 ms 1088 KB Output is correct
16 Correct 0 ms 1088 KB Output is correct
17 Correct 0 ms 1088 KB Output is correct
18 Correct 0 ms 1088 KB Output is correct
19 Correct 0 ms 1088 KB Output is correct
20 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1084 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 1084 KB Output isn't correct
2 Halted 0 ms 0 KB -