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:这题要用64位

Posted by 30018347 at 2008-07-20 15:20:35 on Problem 2193
In Reply To:这题要用64位 Posted by:houxuanfelix at 2006-08-25 09:24:33
请教下64位怎么用啊?我对位数变化不是很熟哦。
就是定义_int64就可以了吗?附代码如下,我是用dp做的,后面一个仁兄也讲mark[i][j]=mark[i][j-1]+mark[i-1][j/2]的dp递推是对的。关键是mark[12][2005]我之前定义int测试些数据时都对了。提交它说wa。后来直接该为_int64,测试数据时我的电脑显示莫名奇妙的数。
#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 k,c,i,j,an[55],n[55],m[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;
}
mark[2][2]=1;
f(mark);
cin>>c;
for(k=0;k<c;k++)
{
	cin>>i>>j;
	n[k]=i;
	m[k]=j;
	an[k]=mark[i][j];
}
for(k=0;k<c;k++)
{
	cout<<"Case "<<k+1<<": n="<<n[k]<<",m="<<m[k]<<",#lists=";
    printf("%I64d ",an[k]);
	cout<<endl;
}
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