题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3067
题意:中文,不解释
题解:一看就知道是要找规律的题,都是有循环节的,看代码。
#include <cstdio>
int main(){
int i,a,n,sum,ans;
while(~scanf("%d",&n)){
for(i=sum=0;i<n;i++,sum+=a)scanf("%d",&a);
for(i = 1; i<sum; i++){
if(sum==(1+i)*i/2){ans = 1;break;}
if(sum<(1+i)*i/2){ans = i;break;}
}
printf("yes\n%d\n",ans);
}
return 0;
}