Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

同志们,求助!

Posted by freeman883 at 2005-05-17 11:13:59 on Problem 1392
这是我的原程序,我就搞不清楚为什么答案错误?
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator