Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int n;
- scanf("%d", &n);
- int a[n], i, sum = 0;
- for(i = 0; i < n; i++)
- {
- scanf("%d", &a[i]);
- sum += a[i];
- }
- if(sum % n != 0)
- {
- printf("Unrecoverable configuration.\n");
- return 0;
- }
- sum /= n;
- int c = 0, max = 0, max_idx, min = 99999, min_idx;
- for(i = 0; i < n; i++)
- {
- if(a[i] != sum) c++;
- if(max < a[i])
- {
- max = a[i];
- max_idx = i;
- }
- if(min > a[i])
- {
- min = a[i];
- min_idx = i;
- }
- }
- if(c == 0)
- {
- printf("Exemplary pages.\n");
- return 0;
- }
- else if(c == 2)
- {
- printf("%d ml. from cup #%d to cup #%d.\n", max - sum, min_idx + 1, max_idx + 1);
- }
- else printf("Unrecoverable configuration.\n");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement