Thursday, June 12, 2014

Codeforces Round #251 (Div. 2), problem: (A) Devu, the Singer and Churu, the Joker solution

Codeforces Round #251 (Div. 2), problem: (A) Devu, the Singer and Churu, the Joker: http://codeforces.com/contest/439/problem/A

Codeforces Round #251 (Div. 2), problem: (A) Devu, the Singer and Churu, the Joker editorial: http://codeforces.com/blog/entry/12545

Codeforces Round #251 (Div. 2), problem: (A) Devu, the Singer and Churu, the Joker solution: http://ideone.com/aF5JQW

#include <iostream>
#include <cstdio>
using namespace std;

int main() {
    int n, d, t, cnt=0;
    scanf("%d%d", &n, &d);
    while(n--) {
        scanf("%d", &t);
        d-=t;
        if(n) d-=10, cnt+=2;
    }
    if(d<0) printf("-1");
    else {
        cnt+=d/5;
        printf("%d", cnt);
    }
    return 0;
}

No comments:

Post a Comment