Last active
October 31, 2018 12:47
-
-
Save feynon/1cf39fe23fa648a3b294eb5f4af1924b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.spoj.com/problems/CPTTRN1/ | |
/* | |
Input: | |
3 | |
3 1 | |
4 4 | |
2 5 | |
Output: | |
* | |
. | |
* | |
*.*. | |
.*.* | |
*.*. | |
.*.* | |
*.*.* | |
.*.*. | |
*/ | |
#include<stdio.h> | |
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int t, l, c, i, j; | |
scanf("%d",&t); | |
for(i=0;i<t;i++) | |
{ | |
for(i=1; i<=l; i++) | |
{ | |
for(j=1; j<=c; j++) | |
{ | |
if((i+j)%2 == 0 ) | |
{ | |
printf("*"); | |
} | |
else | |
{ | |
printf("."); | |
} | |
} | |
} | |
printf("\n\n"); | |
} | |
return 0; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://www.spoj.com/problems/CPTTRN1/ | |
/* | |
Input: | |
3 | |
3 1 | |
4 4 | |
2 5 | |
Output: | |
* | |
. | |
* | |
*.*. | |
.*.* | |
*.*. | |
.*.* | |
*.*.* | |
.*.*. | |
*/ | |
#include<stdio.h> | |
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int t, l, c, i, j; | |
scanf("%d",&t); | |
while(t--) | |
{ | |
scanf("%d %d",&l, &c); | |
for(i=0; i<=l; i++) | |
{ | |
for(j=0; j<=c; j++) | |
{ | |
if((i+j)%2 == 0 ) | |
printf("*"); | |
else | |
printf("."); | |
} | |
printf("\n"); | |
} | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment