Monday, March 16, 2015

Solution of 478A. Initial Bet (Codeforces)

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

int main()
{
    int a, b, c, d, e, sum=0;
    scanf("%d%d%d%d%d", &a, &b, &c, &d, &e);
    sum = (a+b+c+d+e);
    if(sum==0)
        printf("-1");
    else if(sum%5==0)
        printf("%d\n", sum/5);
    else
        printf("-1\n");
}


1 comment:

  1. can you explain this solution please. I am unable to understand the concept.

    ReplyDelete

Compare equality of two string in C

#include <stdio.h> #include<string.h> int main() {     char* country = "Bangladesh";     char* country2;     ...