Islamic Universtiy,Bangladesh TopH 9th CPU CSE Programming Contest E. Array Partition Solution

               

                                         

Problem Link :  https://toph.co/arena?practice=6476b92bd47a320767c00186#!/p/6474e287d47a320767bfdfd9

Solution in C++:

  1. /// Author : AH_Tonmoy
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. int32_t main() {
  5. ios_base::sync_with_stdio(0);
  6. cin.tie(0);
  7. long long n , x ;
  8. cin >> n ;
  9. long long sum = 0 ;
  10. for ( int i = 0 ; i < n ; i++){
  11. cin >> x ;
  12. sum += x ;
  13. }
  14. long long num , k ;
  15. cin >> num >> k ;
  16. if ( sum % num == 0 and sum / num == k ){
  17. cout <<"YES\n";
  18. }
  19. else {
  20. cout <<"NO\n";
  21. }
  22. return 0;
  23. }

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.