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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.