Responsive Ads Here

Wednesday 10 May 2017

CPTTRN1 - Character Patterns (Act 1)

problem id:-http://www.spoj.com/problems/CPTTRN1/

code:--

#include <iostream>
using namespace std;

int main()
{
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
string str=".*";
int k=1;
for(int i=0;i<n;++i)
{
k=(i&1);
for(int j=0;j<m;++j)
{
k=k^1;
cout<<str[k];
}
cout<<'\n';
}
cout<<'\n';
}

return 0;
}

No comments:

Post a Comment