[CF]510A - Fox And Snake
題目:
http://codeforces.com/problemset/problem/510/A
-------------------------------------------------------------------------------------------------
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define N 100
int main(void)
{
long int n,m;
while(scanf("%d%d",&n,&m)!=EOF)
{
int x[N][N];
memset(x,0,sizeof(x));
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(i%4==0 && j!=1)
{
printf(".");
}
else if(i%2==0 && i%4!=0 && j!=m)
{
printf(".");
}
else
{
printf("#");
}
}
printf("\n");
}
}
return 0;
}
http://codeforces.com/problemset/problem/510/A
-------------------------------------------------------------------------------------------------
#include<cstdio>
#include<cstdlib>
#include<cstring>
#define N 100
int main(void)
{
long int n,m;
while(scanf("%d%d",&n,&m)!=EOF)
{
int x[N][N];
memset(x,0,sizeof(x));
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
if(i%4==0 && j!=1)
{
printf(".");
}
else if(i%2==0 && i%4!=0 && j!=m)
{
printf(".");
}
else
{
printf("#");
}
}
printf("\n");
}
}
return 0;
}
留言
張貼留言