| ||||||||||
| 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 | |||||||||
WHY?WA?#include<iostream.h>
#include<math.h>
#include<stdio.h>
__int64 A[502][502],B[502][502],C[502][502];
int main()
{
A[0][0]=1;
A[0][1]=2;
A[1][0]=3;
A[1][1]=1;
int i;
int K;
int ii,jj;
cin>>K;
for(i=1;i<K;i++)
{
for(ii=0;ii<pow(2,i);ii++)
{
for(jj=0;jj<pow(2,i);jj++)
{
B[ii][jj]=A[ii][jj]+(int)(pow(2,i+1));
// printf("%I64d\n ",B[ii][jj]);
if(ii==jj)
{
C[ii][jj]=B[ii][jj]-1;
}
else
{
C[ii][jj]=B[ii][jj];
}
// printf("%I64d\n ",C[ii][jj]);
}
}
/* for(ii=0;ii<2;ii++)
{
for(jj=0;jj<2;jj++)
{
printf("%I64d ",B[ii][jj]);
}
cout<<endl;
}
for(ii=0;ii<2;ii++)
{
for(jj=0;jj<2;jj++)
{
printf("%I64d ",C[ii][jj]);
}
cout<<endl;
}
*/
for(ii=0;ii<pow(2,i+1);ii++)
{
for(jj=0;jj<pow(2,i+1);jj++)
{
if(ii<pow(2,i)&&jj<pow(2,i))
{
A[ii][jj]=A[ii][jj];
}
if(ii<pow(2,i)&&jj>=pow(2,i))
{
A[ii][jj]=B[ii][jj-(int)(pow(2,i))];
}
if(ii>=pow(2,i)&&jj<pow(2,i))
{
A[ii][jj]=C[ii-(int)(pow(2,i))][jj];
}
if(ii>=pow(2,i)&&jj>=pow(2,i))
{
A[ii][jj]=A[ii-(int)(pow(2,i))][jj-(int)pow(2,i)];
}
}
}
}
for(ii=0;ii<pow(2,K);ii++)
{
for(jj=0;jj<pow(2,K);jj++)
{
printf("%I64d ",A[ii][jj]);
}
cout<<endl;
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator