Daffodil International University
Problem Link
//Please follow from main function#include<stdio.h>
int main()
{
int n, i, j, sum, p=0, t=1, arr[10];
while(scanf("%d", &n)!=EOF){
for(i=0; i<n; i++)
scanf("%d", &arr[i]);
for(i=0, j=1; j<n; i++, j++){
sum=arr[i]+arr[j];
if(sum>arr[j+1]){
p=1;
}
}
if(p==1){
printf("Case #%d: It is not a B2-Sequence.\n\n",++t);
}
else{
printf("Case #%d: It is a B2-Sequence.\n\n", ++t);
}
}
return 0;
}
0 Comments