Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎么才能不超时???我已经很费力了!!!#include<stdio.h> #include<math.h> int i,j,n,t=0,s; void main(){ scanf("%d",&n); for(i=1;s=i,i<=ceil(n/2);i++){ for(j=i+1;j<=n;j++){ s=s+j; if(s==n) {t++;break;} else if(s>n)break; } } printf("%d\n",t+1); } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator