My issue
What is actually problem?
I am not able to understand.
My understanding is:
[1,5] is given array then make it to 1+5=6
so size of new array is 6 and it’s all elements are 1.
[1,1,1,1,1,1].
My code
#include <stdio.h>
int main(void) {
int testcase,i,size,max=0;
scanf("%d",&testcase);
while(testcase--)
{
scanf("%d",&size);
int a[size];
for(i=0;i<size;i++)
{
scanf("%d",&a[i]);
}
max=a[0];
for(i=0;i<size;i++)
{
if(a[i]>max)
{
max=a[i];
}
}
printf("%d\n",(max*(max+1)));
}
// your code goes here
return 0;
}
Problem Link: SPLITMAX Problem - CodeChef