Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int y=0, i, n, tempZbir=0, zbir;
- cin >> n;
- int niza[n];
- for(i=0; i<n; i++)
- {
- cin >> niza[i];
- tempZbir+=niza[i];
- }
- if(tempZbir%n!=0){cout << "GRESHKA"; return 0;}
- zbir = tempZbir/n;
- for(i=0; i<n; i++)
- if(niza[i]<zbir) y+=zbir-niza[i];
- cout << y;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment