Welcome to the Editorial of IPC junior-1 (2025–26).
A. Choco-Coco
Author:Aditya_Dave, 202401457, billu_1903
Math, Implementation
We are given an array of size n with total sum S.
If S is divisible by n, the array is already balanced and the answer is "YES".
Otherwise, we can try deleting one element a[i]. After deletion, the new sum becomes S − a[i] and the size becomes n − 1.
To be balanced, (S − a[i]) must be divisible by (n − 1), which means a[i] % (n − 1) == S % (n − 1).
We just need to check if such an element exists.
#include <stdio.h>
int main() {
int x, y, n;
scanf("%d%d", &x, &y);
scanf("%d", &n);
if((x + y) >= n) { // if total chocolates are greater than or equal to number of children, then print YES
printf("YES\n");
} else { // less chocolates than children, print NO
printf("NO\n");
}
return 0;
}
B. Strongest Digit
Author:Raj_Patel_7807
Math, Implementation
We are given an array of size n with total sum S.
If S is divisible by n, the array is already balanced and the answer is "YES".
Otherwise, we can try deleting one element a[i]. After deletion, the new sum becomes S − a[i] and the size becomes n − 1.
To be balanced, (S − a[i]) must be divisible by (n − 1), which means a[i] % (n − 1) == S % (n − 1).
We just need to check if such an element exists.
#include
int main() {
int t;
scanf("%d", &t); // taking the number of test cases
while (t--) { // loop runs for each test case
long long n;
scanf("%lld", &n); // input number for the current test case
int maxi = 0;
while (n > 0) {
int rem = n % 10; // extract last digit
if (rem > maxi) {
maxi = rem; // update maximum digit
}
n /= 10; // remove last digit
}
printf("%d\n", maxi); // print maximum digit
}
return 0;
}



