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 |
Re:同志们,求助!In Reply To:同志们,求助! Posted by:freeman883 at 2005-05-17 11:13:59 > 这是我的原程序,我就搞不清楚为什么答案错误? > #include<stdio.h> > #include<math.h> > void main() > {long n,m,s,i,l; > > while(scanf("%ld %ld",&n,&m)!=EOF) > { > if(n==0&&m==0) break; > s=0; > l=m%(2*n); > for(i=0;i<=l;i++) > { > if(i<=n) s=s+pow(2,i-1); > else s=s-pow(2,i-n-1); > } > printf("%ld\n",s); > } > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator