Submission #15428

# Submission time Handle Problem Language Result Execution time Memory
15428 2015-07-12T07:33:39 Z kesakiyo6 님 무기가 좀 나쁘시네여 (kriii3_S) C++
0 / 29
0 ms 1084 KB
#include <stdio.h>
#include <algorithm>

using namespace std;

typedef long long ll;

struct DATA {
    ll val[5];
    DATA() {}
    DATA(ll a, ll b, ll c, ll d, ll e) {
        val[0]=a;
        val[1]=b;
        val[2]=c;
        val[3]=d;
        val[4]=e;
    }
    ll getCost() {
        return val[0]*(100LL+val[1])*(((100LL-min(val[2], 100LL))+min(val[2], 100LL)*val[3]))*(100+val[4]);
    }
    DATA operator - (const DATA& r) {
        return DATA(val[0]-r.val[0], val[1]-r.val[1], val[2]-r.val[2], val[3]-r.val[3], val[4]-r.val[4]);
    }
    DATA operator + (const DATA& r) {
        return DATA(val[0]+r.val[0], val[1]+r.val[1], val[2]+r.val[2], val[3]+r.val[3], val[4]+r.val[4]);
    }
    char inputData() {
        char ch;
        for(int i=0 ; i<5 ; i++)
            ch=scanf("%lld", &val[i]);
        return ch;
    }
    void test() {
        for(int i=0 ; i<5 ; i++)
            printf("%lld ", val[i]);
        puts("");
    }
};

char comp(DATA prev, DATA cur) {
    ll prevCost=prev.getCost();
    ll curCost=cur.getCost();
    if(prevCost==curCost) return '0';
    else if(prevCost<curCost) return '+';
    else return '-';
}

DATA ca, cb, w1, w2, pa, pb;

int main() {
    while(1) {
        ca.inputData();
        cb.inputData();
        w1.inputData();
        if(w2.inputData()==EOF) break;
        pa=ca-w1;
        pb=cb-w2;
        printf("%c\n", comp(ca, pa+w2));
        printf("%c\n", comp(cb, pb+w1));
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1084 KB Output is correct
2 Correct 0 ms 1084 KB Output is correct
3 Correct 0 ms 1084 KB Output is correct
4 Incorrect 0 ms 1084 KB Output isn't correct
5 Halted 0 ms 0 KB -