Codeforces 478A - Initial Bet Solution

 Solution in C++: 

///******Bismillahir-Rahmanir-Rahim******///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh 

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. main()
  4. {
  5. int s=0,a[10],i;
  6. for(i=0;i<5;i++)
  7. {
  8. cin>>a[i];
  9. s+=a[i];
  10. }
  11. if((s!=0)&&(s%5==0))
  12. cout<<s/5<<endl;
  13. else
  14. cout<<"-1"<<endl;
  15. }

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.