https://i1.wp.com/eblogarithm.com/wp-content/uploads/2017/01/Codeforces-Round-390-Div-2-problem-A-Lesha-and-array-splitting-Solution-in-CC1.png?fit=640%2C360

Codeforces Round #390 (Div. 2), problem: (A) Lesha and array splitting Solution in C/C++

Codeforces Round #390 (Div. 2), problem: (A) Lesha and array splitting Solution in C/C++

 

#include<stdio.h>
#include<stdlib.h>
typedef unsigned u;
u A[111];
int main()
{
	u n,i=-1,j=0;
	for(scanf("%u",&n);++i<n;j+=A[i])scanf("%u",A+i);
	if(j){printf("YES\n1\n1 %u\n",n);return 0;}
	for(i=-1;++i<n&&!A[i];);
	printf(i!=n?"YES\n2\n1 %u\n%u %u\n":"NO\n",i+1,i+2,n);
	return 0;
}

 

(Visited 107 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: