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++:
- /// Author : AH_Tonmoy
- #include <bits/stdc++.h>
- using namespace std;
- int32_t main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- long long n , x ;
- cin >> n ;
- long long sum = 0 ;
- for ( int i = 0 ; i < n ; i++){
- cin >> x ;
- sum += x ;
- }
- long long num , k ;
- cin >> num >> k ;
- if ( sum % num == 0 and sum / num == k ){
- cout <<"YES\n";
- }
- else {
- cout <<"NO\n";
- }
- return 0;
- }
No comments