-
Notifications
You must be signed in to change notification settings - Fork 0
/
p2.cpp
58 lines (55 loc) · 1.18 KB
/
p2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
//Google code jam'22 qualification round Q1-Punched cards.
#include<iostream>
using namespace std;
int main()
{
int t,r,c;
cin>>t;
int ar[t][2];
for(int i=0;i<t;i++)
{
for(int j=0;j<2;j++)
{
cin>>ar[i][j];
}
}
for(int k=0;k<t;k++)
{
cout<<"Case #"<<k+1<<":"<<endl;
for(int i=1;i<=(2*ar[k][0]+1);i++)
{
for(int j=1;j<=(2*ar[k][1]+1);j++)
{
if(i<=2 && j<=2)
cout<<".";
if(i%2!=0 && j>2)
{
if(j%2!=0)
cout<<"+";
else
cout<<"-";
}
if(i%2==0 && j>2)
{
if(j%2!=0)
cout<<"|";
else
cout<<".";
}
if(i>=3 && j<=2)
{
if(i%2!=0 && j%2!=0)
cout<<"+";
else if(i%2!=0 && j%2==0)
cout<<"-";
else if(i%2==0 && j%2!=0)
cout<<"|";
else if(i%2==0 && j%2==0)
cout<<".";
}
}
cout<<"\n";
}
}
cout<<"\n";
}