| ||||||||||
| 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 | |||||||||
为什么总是CE和TLE#include<stdio.h>
#include<math.h>
int i,n,k,x,y,t;
int main()
{
while(scanf("%d",&n)&&n!=-1)
{
k=pow(3,n-1);
for(i=0;i<k*k;i++)
{
for(x=i/k,y=i%k,t=n;--t&&(x%3+y%3)%2==0;x/=3,y/=3);
{
if(t==0)printf("X"); else printf(" ");
if(i%k>=k-1)puts("");
//printf("%c%s",t?32:88,i%k<k-1?"":"\n");
}
}
puts("-");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator