hdu_3067_小t的游戏(脑洞)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3067
题意:中文,不解释
题解:一看就知道是要找规律的题,都是有循环节的,看代码。
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <cstdio> 2 3 int main(){ 4 int i,a,n,sum,ans; 5 while(~scanf("%d",&n)){ 6 for(i=sum=0;i<n;i++,sum+=a)scanf("%d",&a); 7 for(i = 1; i<sum; i++){ 8 if(sum==(1+i)*i/2){ans = 1;break;} 9 if(sum<(1+i)*i/2){ans = i;break;} 10 } 11 printf("yes\n%d\n",ans); 12 } 13 return 0; 14 }