http://codeforces.com/problemset/problem/510/A
模拟水水题
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m;
while(cin>>n>>m)
{
for(int i=1;i<=n;i++)
{
if(i%2==1)
{
for(int j=0;j<m;j++)
{
cout<<"#";
}
cout<<endl;
}
else {
if(i%4==0)
{
cout<<"#";
for(int j=0;j<m-1;j++)
{
cout<<".";
}
cout<<endl;
}
else{
for(int j=0;j<m-1;j++)
{
cout<<".";
}
cout<<"#"<<endl;
}
}
}
}
return 0;
}

本文提供 CodeForces 平台上的题目 510A 的解答代码实现。该题通过简单的循环和条件判断,输出特定模式的字符矩阵。适用于初学者练习循环和条件语句。
520

被折叠的 条评论
为什么被折叠?



