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 |
低调~In Reply To:超水!! 0MS就ok 代码共享 Posted by:z1160y at 2009-05-23 01:52:54 #include<iostream> using namespace std; int main() {int m,n,k,N; cin>>N; for(int l=1;l<=N;l++) {cin>>k>>m; for(int i=1;;i++) {if(m>=(i+1)*i/2&&m<(i+2)*(i+1)/2 ) {n=i;break;} } int t=0; for(int j=2;j<=n;j++) {if( (2*m-(j-1)*j)%(2*j)==0 ) t++; } cout<<k<<" "<<t<<endl; } system("pause"); return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator