text stringlengths 49 983k |
|---|
#include<bits/stdc++.h>
using namespace std;
bool isPrime(int n)
{
if(n<2) return false;
for(int i=2;i*i<=n;i++) if(n%i==0) return false;
return true;
}
int main()
{
int Q; cin>>Q;
int cnt=0;
while(Q--){
int n; cin>>n;
if(isPrime(n)) cnt++;
}
cout<<cnt<<endl;
return 0;
}
|
#include <iostream>
using namespace std;
int n,k,t=0;
bool prime(int o)
{
if(o<2)return false;
for(int i=2;i*i<=o;i++)if(o%i==0)return false;
return true;
}
int main()
{
cin>>n;
while(n--)
{
cin>>k;
if(prime(k))t++;
}
cout<<t<<endl;
return 0;
}
|
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
cin >> n;
int p;
int count = 0;
for (int i = 0; i < n; i++)
{
cin >> p;
for (int j = 2; j < int(sqrt(p) + 1); j++)
{
if (p % j == 0)
{
count++;
break;
}
}
}
cout << n - count << endl;
}
|
#include<bits/stdc++.h>
using namespace std;
bool hantei(int64_t x){
for(int i=2; i*i<=x; i++){
if(x%i==0) return 0;
}
return x>1;
}
int main() {
int n; cin >> n;
int cnt{};
for(int i=0; i<n; i++){
int c; cin>>c;
cnt+=hantei(c);
}
cout << cnt<<endl;
}
|
#include <iostream>
#include <cmath>
using namespace std;
bool isPrime(int a){
int x = (int)sqrt(a);
int val = 1;
for (int i = 2; i <= x; i++) val *= (a % i != 0);
return (val == 1);
}
int main(){
int n, count, a;
cin >> n;
count = 0;
for (int i = 0; i != n; i++){
cin >> a;
count += isPrime(a);
}
cout << count << endl;
}
|
#include<bits/stdc++.h>
bool prime(int x)
{
for(int i=2;i*i<=x;i++)
if(x%i==0)
return false;
return true;
}
int main()
{
int n,ans=0;
scanf("%d",&n);
for(int i=0;i<n;i++)
{
int t;
scanf("%d",&t);
if(prime(t)) ans++;
}
printf("%d\n",ans);
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int x;
int counter = 0;
for (int i = 0; i < n; i++) {
cin >> x;
int ccounter = 0;
for (int j = 1; j <= int(sqrt(x)); j++) {
if (x%j == 0) { ccounter++; }
}
if (ccounter == 1) { counter++; }
}
cout << counter << endl;
}
|
#include<iostream>
using namespace std;
int prime(int x){
for(int j=2;j*j<=x;j++){
if(x%j==0){
return 0;
}
}
return 1;
}
int main(){
int n,x,ans=0;
cin>>n;
for(int i=0;i<n;i++){
cin>>x;
ans+=prime(x);
}
cout<<ans<<endl;
return 0;
} |
//ALDSC_1
#include<iostream>
using namespace std;
int main(){
int n;
int ans=0,tmp;
bool f;
cin>>n;
for(int i=0;i<n;i++){
cin>>tmp;
f=1;
for(int j=2;j*j<=tmp;j++){
if(tmp%j==0)f=0;
}
ans+=f;
}
cout<<ans<<endl;
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
bool ok(int n)
{
int flag = true ;
for(int i =2;i<=sqrt(n);i++)
if(n%i==0) flag=false;
return flag;
}
int main()
{
int n;
cin>>n;
int a,ans=0;
for(int i = 1 ;i<=n;i++)
{
cin>>a;
if(ok(a)) ans++;
}
cout<<ans<<endl;
return 0;
}
|
#include <iostream>
#include <cmath>
using namespace std;
int main() {
int n,x,t=0;
cin >> n;
for(int i=0;i<n;++i){
cin >> x;
for(int j=2; j<(int)pow((double)x,0.5)+1; ++j) {
if(x%j==0) {
++t;
break;
}
}
}
cout << (n-t) << endl;
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
int main(){
int h,w;
while(cin>>h>>w,h+w!=0){
for(int i=0;i<h;++i){
for(int j=0;j<w;++j){
cout<<(((i+j)%2==0)?"#":".");
}
cout<<endl;
}
cout<<endl;
}
}
|
#include <iostream>
using namespace std;
int main()
{
int H, W;
while (1)
{
cin >> H >> W;
if (H == 0 && W == 0)
break;
for (int h = 0; h < H; ++h)
{
for (int w = 0; w < W; ++w)
{
cout << ((h + w) % 2 == 0 ? '#' : '.');
}
cout << endl;
}
cout << endl ;
}
}
|
#include<iostream>
using namespace std;
int main(){
int H,W;
int i,j;
while(1){
cin>>H>>W;
if(H==0&&W==0)break;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if(i%2==0&&j%2==0||i%2==1&&j%2==1)cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include <iostream>
using namespace std;
int main() {
int h, w;
while (cin >> h >> w, h!=0||h!=w) {
for (int i=0; i<h; i++) {
for (int j=0; j<w; j++)
cout << ((i+j)%2?'.':'#');
cout << endl;
}
cout << endl;
}
} |
#include<iostream>
using namespace std;
int main(){
int i,H,j,W;
for(;;){
cin>>H>>W;
if(H==0 && W==0)break;
for(i=1;i<=H;i++){
for(j=1;j<=W;j++){
if((i+j)%2==0){
cout<<"#";
}
else{
cout<<".";
}
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include <iostream>
using namespace std;
int main()
{
int h, w;
char a[] = { '#', '.' };
while (cin >> h >> w && h != 0) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if (i % 2 == 0) cout << a[j % 2];
else cout << a[!(j % 2)];
}
cout << "\n";
}
cout << "\n";
}
}
|
#include<iostream>
using namespace std;
int main()
{
int h,w;
while(1){
cin>>h>>w;
if(h==0&&w==0)break;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if((i+j)%2==0)cout<<'#';
else cout<<'.';
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
//itp1_topic1_a
#include <bits/stdc++.h>
using namespace std;
int main(){
while(1){
int H,W;
cin >>H>>W;
if(H ==0 && W==0)break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if((i+j)%2==0)cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
}
|
#include<iostream>
using namespace std;
int main(){
int h, w, i, j;
while (cin >> h >> w, h || w){
for (i = 0; i < h;++i){
for (j = 0; j < w; ++j)
cout << ((i % 2) ? ((j % 2) ? "#" : ".") : ((j % 2) ? "." : "#"));
cout << endl;
}
cout << endl;
}
} |
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int H,W;
int i,j;
while(1){
cin>>H>>W;
if(H==0&&W==0) break;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if((i+j)%2==0){
cout<<"#";
}
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include <cstdio>
int main(){
while(1){
int one, two;
scanf(" %d %d", &one, &two);
if(one==0 && two==0) break;
for(int i=0; i<one; ++i){
for(int j=0; j<two; ++j){
if( (i+j)%2==0 ) printf("#");
else printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
int a, b;
while(1){
cin >> a >> b;
if(a == 0 && b == 0)
break;
for(int i = 0; i < a; i++){
for(int j = 0; j < b; j++){
if((i+j)% 2 == 0)
cout << "#";
else
cout << ".";
}
cout << endl;
}
cout << endl;
}
}
|
#include<iostream>
using namespace std;
int main(){
int h,w;
while(1){
cin >> h >> w;
if(h==0 && w==0)break;
for(int i=0; i<h; i++){
for(int j=0; j<w; j++){
if(i%2==0 && j%2==1 || i%2==1 && j%2==0)cout << ".";
else cout << "#";
}
cout <<endl;
}
cout <<endl;
}
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
int H, W;
cin >> H >> W;
while(H != 0 || W != 0) {
for(int i = 0; i < H; i++) {
for(int j = 0; j < W; j++) {
if((i + j) % 2 == 0) cout << "#";
else cout << ".";
}
cout << endl;
}
cout << endl;
cin >> H >> W;
}
}
|
#include <iostream>
using namespace std;
int main() {
int h,w;
while(true)
{
cin >> h >> w;
if(h==0&&w==0)
break;
for(int i=0;i<h;i++){
for(int t=0;t<w;t++){
if(((i%2)+(t%2))%2==0)
cout << "#";
else
cout << ".";
}
cout << endl;
}
cout << endl;
}
}
|
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
int h,w;
while(1)
{
cin>>h>>w;
if(h==0&&w==0)break;
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
if(i%2==0&&j%2==1 || i%2==1&&j%2==0)cout<<".";
else cout<<"#";
}
cout<<endl;
}
cout<<endl;
}
}
|
#include<cstdio>
using namespace std;
int main(){
int w,h;
int cnt=0;
while(1){
scanf("%d %d",&h,&w);
if(w==0 && h==0){
return 0;
}
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if((i+j)%2==0){
printf("#");
}else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
}
|
#include <iostream>
using namespace std;
int main() {
int h, w;
while (true) {
cin >> h >> w;
if (h == 0 && w == 0) break;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if ((i + j) % 2 == 0) cout << "#";
else cout << ".";
}
cout << endl;
}
cout << endl;
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
int h,w,i,j;
for(;;){
cin>>h>>w;
if(h==0)exit(0);
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if((i+j)%2){cout<<".";}else{cout<<"#";}
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include<iostream>
using namespace std;
int main(){
int H,W;
while(1){
cin >> H >> W;
if(H==0&&W==0)break;
for(int i=1;i<=H;i++){
for(int j=1;j<=W;j++){if((i+j)%2==1){cout << ".";}else{cout << "#";}
}
cout << "\n";
}
cout << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(){
while(1){
int H, W;
cin>>H>>W;
if(H == 0 && W == 0) break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if((i + j) %2 == 0) cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
}
|
#include<stdio.h>
using namespace std;
int main(){
while(1){
int h,w;
scanf("%d %d\n", &h,&w);
if(h==0 && w==0) break;
for(int i=0; i<h; i++){
for(int j=0; j<w; j++){
if((i+j)%2 == 0) printf("#");
if((i+j)%2 != 0) printf(".");
}
printf("\n");
}
printf("\n");
}
}
|
#include <iostream>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
do{
for(int i=1;i<=a;i++){
for(int j=1;j<=b;j++){
if ((i+j)%2==0)
cout<<"#";
else cout<<".";
}
cout<<endl;
}
cin>>a>>b;
cout<<endl;
}while (a!=0 || b!=0);
}
|
#include <iostream>
using namespace std;
int main(void)
{
while(1){
int H, W;
cin >> H >> W;
if(!(H || W)) break;
for(int i = 1; i <= H; i++) {
for(int j = 1; j <= W; j++) {
cout << ((i + j) % 2 == 0 ? "#" : ".");
}
cout << endl;
}
cout << endl;
}
return 0;
} |
// AOJ ITP 1_5_C
#include<cstdio>
#define rep(i,a) for( int i = 0; i != (a); ++i )
int main()
{
int H, W;
while( scanf( "%d%d", &H, &W ), H|W )
{
rep( i, H )
{
rep( j, W )
putchar( i&1 ? (j&1 ? '#' : '.') : (j&1 ? '.' : '#') );
puts("");
}
puts("");
}
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
int main(){
int H,W;
while(true){
cin >>H >>W;
if(H==0&&W==0)break;
for(int j=0; j<H; j++){
for(int i=0; i<W; i++){
if((i+j)%2==0)cout<<"#";
else cout<<".";
}
cout <<endl;
}
cout <<endl;
}
return 0;
}
|
#include <iostream>
using namespace std;
int main(void){
for(;;){
int h, w;
cin >> h >> w;
if(h == 0 && w == 0)
break;
for(int i = 0; i < h; i++){
for(int j = 0; j < w; j++)
cout << ((i+j) % 2 ? '.' : '#');
cout << endl;
}
cout << endl;
}
}
|
#include<iostream>
using namespace std;
int main(){
int H,W;
while(1){
cin >> H >> W;
if( H==0 && W==0)
break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if( (i+j)%2==0 ){
cout << '#';
}else {
cout << '.';
}
}
cout << "\n";
}
cout << "\n";
}
return 0;
} |
#include<iostream>
using namespace std;
int main(void)
{
int h,w,i,j;
while(1){
cin>>h>>w;
if(h==0 && w==0) break;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if((i+j)%2==0) cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
int i,j,H,W;
while(1){
cin >> H >> W;
if((H == 0)&&(W == 0)) break;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if((i+j)%2 == 0){
cout << "#";
}else{
cout << ".";
}
}
cout << endl;
}
cout << endl;
}
return 0;
} |
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
int h,w;
cin >> h >> w;
while(h!=0 || w!=0){
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if((i+j)%2==0){
cout << "#";
}else{
cout << ".";
}
}
cout << endl;
}
cout << endl;
cin >> h >> w;
}
} |
#include <cstdio>
int main(){
while(1){
int h, w;
scanf(" %d %d", &h, &w);
if(h==0 && w==0) break;
for(int i=0; i<h; ++i){
for(int j=0; j<w; ++j){
if( (i+j)%2==0 ) printf("#");
else printf(".");
}
printf("\n");
}
printf("\n");
}
return 0;
} |
#include <stdio.h>
int main(){
int H,W,i,j;
while(scanf("%d%d",&H,&W),H|W){
for(i=0;i<H;i++){
for(j=0;j<W;j++) printf("%c",(i+j)%2?'.':'#');
printf("\n");
}
printf("\n");
}
return 0;
} |
#include<cstdio>
int main(void){int h,w,i,j;scanf("%d%d",&h,&w);while((h!=0)||(w!=0)){for(i=0;i<h;++i){for(j=0;j<w;++j){printf("%c",((j+i)%2)?'.':'#');}puts("");}puts("");scanf("%d%d",&h,&w);}return(0);}
|
#include<iostream>
using namespace std;
int main()
{
int H, W;
while (true) {
cin >> H >> W;
if (H == 0 && W == 0)break;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
if ((i + j) % 2 == 0)cout << "#";
else {
cout << ".";
}
}
cout << "\n";
}
cout << "\n";
}
}
|
#include<iostream>
using namespace std;
int h, w;
int main() {
while (cin >> h >> w, h) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if ((i + j) % 2) cout << ".";
else cout << "#";
}
cout << endl;
}
cout << endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main() {
int H, W;
while (cin >> H >> W && (H || W)) {
for (int i = 0; i < H; ++i) {
for (int j = 0; j < W; ++j) {
if ((i + j) % 2 == 0) {
cout << '#';
} else {
cout << '.';
}
}
cout << '\n';
}
cout << '\n';
}
}
|
#include<bits/stdc++.h>
using namespace std;
int main()
{
while(true)
{
int h,w;
cin>>h>>w;
if(h==0 && w==0) break;
for (int i = 0; i < h; ++i)
{
for (int j = 0; j < w; ++j)
{
cout<<((i+j)%2==0? "#":".");
}
cout<<endl;
}
cout<<endl;
}
}
|
#include <cstdio>
int main(){
int H,W;
while(1){
scanf("%d %d",&H,&W);
if(!W&&!H){break;}
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(!(i%2-j%2)){putchar('#');}
else{putchar('.');}
}
putchar('\n');
}
putchar('\n');
}
} |
#include <bits/stdc++.h>
using namespace std;
int main() {
int w, h;
while (cin >> h >> w, w) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
cout << "#."[(i + j) & 1];
}
cout << endl;
}
cout << endl;
}
}
|
#include <iostream>
using namespace std;
int main(){
while(1){
int h,w; cin >> h >> w;
if(h==0)break;
for(int i=0; i<h; i++){
for(int j=0; j<w; j++){
if((i+j) % 2 == 0)
cout << "#";
else
cout << ".";
}
cout << endl;
}
cout << endl;
}
} |
#include <iostream>
using namespace std;
int main() {
int h, w;
while (cin >> h >> w, h | w) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if ((i + j) & 1) cout << ".";
else cout << "#";
}
cout << endl;
}
cout << endl;
}
return 0;
}
|
#include <iostream>
using namespace std;
int main(void){
int h,w;
while(cin>>h>>w,w!=0&&h!=0){
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if((i+j)%2==0)
cout<<"#";
else
cout<<".";
}
cout<<endl;
}
cout<<endl;
}
} |
#include<iostream>
using namespace std;
int main(){
int H,W,i,j,ans=0;
for(;;){
cin>>H>>W;
if(H==0&&W==0){
break;
}
for(i=0;i<H;i++){
for(j=0;j<W;j++){
ans=(i+j)%2;
if(ans==0){
cout<<"#";
}else{
cout<<".";
}
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include <iostream>
using namespace std;
int main() {
int H, W;
while(1){
cin>>H>>W;
if(H==0&&W==0) break;
for(int i=0; i<H; i++){
for(int j=0; j<W; j++){
if((i+j)%2==0){
cout<<"#";
}else{cout<<".";}}cout<<"\n";}cout<<endl;}
// your code goes here
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
int main() {
int h,w;
while(cin >> h >> w)
{
if(h==0)break;
for(int i=0;i<h;i++)
{
for(int j=0;j<w;j++)
{
if((i+j)%2==0)
cout << '#';
else
cout << '.';
}
cout << endl;
}
cout << endl;
}
}
|
#include <iostream>
using namespace std;
int main(){
int H,W;
cin>>H>>W;
while(1){
if(H==0&&W==0)break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(i%2==0&&j%2==0||i%2==1&&j%2==1)
cout<< "#";
else cout<< ".";
}cout<<endl;
}
cout<<endl;
cin>>H>>W;
}
return 0;
}
|
#include<cstdio>
using namespace std;
int main(void)
{
int i,j,h,w,flg,k;
scanf("%d %d",&h,&w);
while(!(h==0 && w==0)){
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if((i+j)%2==1) printf(".");
else printf("#");
}
printf("\n");
}
scanf("%d %d",&h,&w);
printf("\n");
}
return 0;
} |
#include <cstdio>
int main() {
int h, w;
while (1) {
scanf("%d %d", &h, &w);
if (!h && !w) break;
for (int i = 1; i <= h; i++) {
for (int j = 1; j <= w; j++) {
putchar(!((i + j) % 2) ? '#' : '.');
}
puts("");
}
puts("");
}
} |
#include<iostream>
using namespace std;
int main() {
while(1) {
int h,w; cin>>h>>w;
if(h==0&&w==0) break;
for(int i=0;i<h;i++) {
bool flag = (i+1)%2;
for(int j=0;j<w;j++) {
if(flag) cout<<"#";
else cout<<".";
flag = !flag;
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include<bits/stdc++.h>
using namespace std;
int main(){
int r,c;
while (cin >> r >> c){
if (!(r | c)) break;
for (int i=0;i<r;i++){
for (int j=0;j<c;j++){
cout << (((i + j)%2 == 0) ? '#' : '.');
}
cout << endl;
}
cout << endl;
}
}
|
#include <iostream>
using namespace std;
int main() {
int H,W;
while(1){
cin >> H >> W;
if(H==0 && W==0)break;
for(int i = 0; i < H; i++){
for(int k = 0; k < W; k++){
if((i+k)%2 == 0) cout << "#";
else cout << ".";
}
cout << "\n";
}
cout << "\n";
}
return 0;
} |
#include<iostream>
using namespace std;
int main(void){
int H,W;
while(1){
cin>>H>>W;
if(H==0&&W==0)return 0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(i%2==0&&j%2==1)cout<<'.';
else if(i%2==1&&j%2==0)cout<<'.';
else cout<<'#';
}
cout<<endl;
}
cout<<endl;
}
}
|
#include<iostream>
using namespace std;
int main() {
int H, W;
while (true) {
cin >> H >> W;
if (H + W == 0)break;
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cout << (((i + j) % 2 == 0) ? "#" : ".");
}
cout << endl;
}
cout << endl;
}
return 0;
} |
#include<iostream>
using namespace std;
int main(){
int H,W;
while(1){
cin >>H>>W;
if (W==0 && H==0) break;
for (int i=1; i<=H; i++){
for (int k=1; k<=W; k++){
if ((i+k)%2==0) cout <<"#";
else cout << ".";
}
cout <<"\n";
}
cout << "\n";
}
return 0;
} |
#include <stdio.h>
int main(void) {
int h, w, i, j;
scanf("%d %d", &h, &w);
while( h != 0 && w != 0 ) {
for(i = 0; i < h; ++i ) {
for(j = 0; j < w; ++j ) {
if((i%2==0&&j%2==0)||(i%2==1&&j%2==1) ) {
putchar('#');
} else {
putchar('.');
}
}
putchar('\n');
}
putchar('\n');
scanf("%d %d", &h, &w);
}
return 0;
} |
#include <iostream>
using namespace std;
int main(){
int H,W;
while(1){
cin >> H >> W;
if(H==0 && W==0) return 0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if((i+j)%2==1) cout << ".";
else cout << "#";
}
cout << endl;
}
cout << endl;
}
} |
#include <iostream>
using namespace std;
int main(){
int h, w, i, j;
while(1) {
cin >> h >> w;
if ((h == 0) && (w == 0)) break;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
if ((i + j) % 2 == 0) cout << "#";
else cout << ".";
}
cout << endl;
}
cout << endl;
}
return 0;
} |
#include<stdio.h>
int main(void)
{
int i,j,a,b;
while(1){
scanf("%d %d",&a,&b);
if(a==0&&b==0){
break;
}
for(i=1;i<=a;i++){
for(j=1;j<=b;j++){
if((i+j)%2==0){
printf("#");
}
else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
} |
#include<iostream>
using namespace std;
int main()
{
int H;
int W;
while (cin >> H >> W,H || W)
{
for (int i = 0; i < H; i++)
{
for (int j = 0; j < W; j++)
{
if ((i+j)%2==1)
{
cout << ".";
}
else cout << "#";
}
cout << endl;
}
cout << endl;
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
unsigned int H, W;
while(cin>>H>>W && H !=0 && W!=0) {
for(int i=1; i<=H; i++) {
for(int j=1; j<=W; j++){
if((i+j)%2 == 0) cout << '#';
else cout << '.';
}
cout << endl;
}
cout << endl;
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
int H,W;
while(cin>>H>>W){
if(H==0&&W==0) break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if((i+j)%2==0){
cout<<"#";
}else{
cout<<".";
}
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
int h,w;
while(1){
cin >> h >> w;
if(h==0 && w==0)break;
for(int i=1; i<=h; i++){
for(int j=1; j<=w; j++){
if((i+j)%2==0) cout << "#";
else cout << ".";
}
cout <<endl;
}
cout <<endl;
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
int h,w;
while(1){
cin>>h>>w;
if(h==0&&w==0) break;
for(int i=1;i<=h;i++){
for(int j=1;j<=w;j++){
if((i+j)%2==0){
cout<<'#';
}else{
cout<<'.';
}
}
cout << endl;
}
cout<<endl;
}
return 0;
} |
#include <iostream>
using namespace std;
int main() {
int h, w;
while (cin >> h >> w, h | w) {
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
cout << ((i + j) % 2 ? "." : "#");
}
cout << endl;
}
cout << endl;
}
} |
#include <iostream>
using namespace std;
int main() {
int h, w;
while (true) {
cin >> h >> w;
if (h == 0 && w == 0) break;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
if ((i + j) % 2 == 0) cout << "#";
else cout << ".";
}
cout << endl;
}
cout << endl;
}
}
|
#include<iostream>
using namespace std;
int main(){
int H,W;
int i,j;
while(1){
cin >> H >> W;
if(H==0 && W==0) break;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if((i+j) % 2 == 0){
cout << "#";
} else {
cout << ".";
}
}
cout << "\n";
}
cout << endl;
}
return 0;
} |
#include<stdio.h>
int main(){
int a,b;
for(;;){
scanf("%d%d",&a,&b);
if(a==0&&b==0){
break;
}
for(int i=0;i<a;i++){
for(int j=0;j<b;j++){
if((i+j)%2==1){
printf(".");
}else{
printf("#");
}
}printf("\n");
}
printf("\n");
}
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
int main(){
int h,w;
while(1){
cin>>h>>w;
if (h==0 && w==0) break;
for(int i=0;i<h;i++){
for (int j=0;j<w;j++){
if ((i+j)%2==0) cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
int H,W,i,j,a;
for(;;){
cin>>H>>W;
if(H==0&&W==0){
break;
}
for(i=0;i<H;i++){
for(j=0;j<W;j++){
a=i+j;
if(a%2==1){
cout<<".";
}
if(a%2==0){
cout<<"#";
}
}cout<<endl;
}cout<<endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;
int main(){
while(1){
int H, W;
cin>>H>>W;
if(H == 0 && W == 0) break;
int i, j;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
if((i + j) % 2 == 0) cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include<cstdio>
int main(){
int h,w;
scanf("%d %d", &h, &w);
while(h && h){
for(int i = 0; i < h ; i++){
for(int j = 0; j < w; j++){
if((i + j) % 2)
{
printf(".");
}else{
printf("#");
}
}
printf("\n");
}
printf("\n");
scanf("%d %d", &h, &w);
}
} |
#include<iostream>
using namespace std;
int main(void){
int h,w,i,j;
while(1){
cin>>h>>w;
if(h==0&&w==0)break;
for(i=0;i<h;i++){
for(j=0;j<w;j++){
if((i%2==0&&j%2==0)||(i%2!=0&&j%2!=0)){
cout<<"#";
}else{
cout<<".";
}
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include <iostream>
using namespace std;
int main(){
int H, W;
while(1){
cin>>H>>W;
if(H==0 && W==0) break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if((i+j) % 2 == 0) cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include<iostream>
using namespace std;
int main(){
while(1){
int H,W;
cin>>H>>W;
if(H==0&&W==0) break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if((i+j)%2==0)cout<<"#";
else
cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include <iostream>
using namespace std;
int main()
{
int H, W;
while(cin >> H >> W && H != 0 || W != 0)
{
for(int i = 0; i < H; ++i)
{
for(int j = 0; j < W; ++j)
{
cout << ((i + j) % 2 == 0 ? "#" : ".");
}
cout << endl;
}
cout << endl;
}
return 0;
}
|
#include<stdio.h>
int main() {
int i, j;
int h, w;
while (1) {
scanf("%d %d", &h, &w);
if (!(h||w))break;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
((i + j) % 2) ? printf(".") : printf("#");
}
printf("\n");
}
printf("\n");
}
return 0;
} |
#include<bits/stdc++.h>
using namespace std;
int main(){
for(;;){
int x,y;
cin>>x>>y;
if(x==0 && y==0)break;
for(int i=0;i<x;i++){
for(int g=0;g<y;g++){
int a=g%2+i%2;
if (a==0||a==2){cout<<"#";}
else{cout<<".";}
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include<iostream>
using namespace std;
int main(){
int h, w;
while(cin>>h>>w, h){
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if((i%2==0&&j%2==0)||(i%2==1&&j%2==1)) cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include<iostream>
#include<string>
using namespace std;
int main(){
for(;;){
int H,W;
cin>>H>>W;
if(H==0&&W==0)break;
else{
for(int a=0;a<H;a++){
for(int b=0;b<W;b++){
if((a+b)%2==0){
cout<<"#";
}else{
cout<<".";
}
}
cout<<endl;
}
cout<<endl;
}
}
}
|
#include <iostream>
using namespace std;
int main() {
int a,b;
while(1){
cin>>a>>b;
if (a==0 && b==0){break;}
for(int i=0; i<a; i++){
for(int j=0; j<b; j++){
if((i+j)%2==0){
cout<<"#";
}else{
cout<<".";
}
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include <bits/stdc++.h>
using namespace std;;
int main(){
while(1){
int H,W;
cin>>H>>W;
if(H==0 && W==0)break;
for(int i=0; i<H; i++){
for(int j=0; j<W; j++){
if((i+j)%2 ==0) cout<<"#";
else cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
}
|
#include <iostream>
using namespace std;
int main() {
int H,W;
while(1){
cin >>H>>W;
if (H==0 && W==0) break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if((i+j)%2==0){
cout << "#";
}
else {
cout <<".";
}
}
cout << endl;
}
cout << endl;
}
return 0;
} |
#include <iostream>
using namespace std;
int main() {
while(true){
int H,W;
cin >> H >> W;
if(H==0 && W==0){break;}
for(int i=1;i<=H;i++){
for(int j=1;j<=W;j++){
if((i+j)%2==0){cout<<"#";}
else{cout<<".";}
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include <iostream>
using namespace std;
int main(){
int h,w;
while(cin>>h>>w){
if(h==0&&w==0)break;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if((i+j)%2==0)cout<<"#";
else if((i+j)%2==1)cout<<".";
}
cout<<endl;
}
cout<<endl;
}
return 0;
} |
#include <bits/stdc++.h>
using namespace std;
int main(){
while(true){
int h,w;
cin >> h >> w;
if(h==0)break;
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
if((i+j)%2==0)cout << '#';
else cout << '.';
}
cout << endl;
}
cout << endl;
}
return 0;
} |
#include <cstdio>
int main() {
int h, w;
for (;;) {
scanf("%d%d", &h, &w);
if (h == 0 && w == 0) break;
for (int i = 0; i < h; i++) {
for (int j = 0; j < w; j++) {
putchar(((i & 1) ^ (j & 1)) == 0 ? '#' : '.');
}
putchar('\n');
}
putchar('\n');
}
return 0;
}
|
#include<iostream>
using namespace std;
int main()
{
int x,y;
while (1)
{
cin >> x >> y;
if (x == 0 && y == 0)
break;
for (int i = 0; i < x; i++)
{
for (int j = 0; j < y; j++)
{
if ((i + j) % 2 == 0)
cout << '#';
else
cout << '.';
}
cout << endl;
}
cout << endl;
}
return 0;
} |
#include<iostream>
using namespace std;
int main(void){
while(1){
int H,W;
cin>>H>>W;
if(H==0&&W==0)break;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if((i+j)%2==0){cout<<"#";}
else {cout<<".";}
}cout<<endl;
}
cout<<endl;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.