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

Re:记得输出时%I64d就好了,参照楼下的dp公式

Posted by 30018347 at 2008-07-20 20:23:47 on Problem 2193
In Reply To:记得输出时%I64d就好了,参照楼下的dp公式 Posted by:ecust_xuchen at 2008-07-20 16:07:48
我改回来了。用c++提交居然comile error.无语啊。。麻烦哪位大牛指点下为什么是这样

#include<iostream>
#include<math.h>
using namespace std;


void f(_int64 a[12][2005])
{
	int i,j;
	for(i=2;i<12;i++)
		for(j=pow(2.0,i-1)+1;j<2005;j++)
				a[i][j]=a[i][j-1]+a[i-1][j/2];
}
		

int main()
{
_int64 mark[12][2005];//行为组数N,列为最大数M,N<=M
int h,l,c,k,n[55],m[55];
_int64 i,j,an[55];

for(j=1;j<2005;j++)mark[1][j]=j;

for(i=2;i<12;i++)
{
	for(j=0;j<pow(2.0,i-1);j++)
	mark[i][j]=0;
	mark[i][j]=1;
}
f(mark);
cin>>c;
for(k=0;k<c;k++)
{
	cin>>h>>l;
	n[k]=h;
	m[k]=l;
	an[k]=mark[h][l];
}
for(k=0;k<c;k++)
{
	cout<<"Case "<<k+1<<": n="<<n[k]<<",m="<<m[k]<<",#lists=";
    printf("%I64d\n", an[k]);
}
return 0;
}


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