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 |
想到枚举以为超时了,结果0ms,我晕#include <cstdio> int main() { int T; scanf("%d",&T); for(int k=1;k<=T;++k) { int number,t; scanf("%d%d",&t,&number); int ans=0,sum=0; printf("%d ",k); for(int i=1;(i+2)*(i+1)<=2*number;++i) { sum+=i; if((number-sum)%(i+1)==0)++ans; } printf("%d\n",ans); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator