반응형
https://www.acmicpc.net/problem/15685
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
#include<iostream>
#include<cmath>
using namespace std;
int N;
int dy[4] = {0,-1,0,1};
int dx[4] = {1,0,-1,0};
int dragone[4][1025]={0,};
struct V{
int x;
int y;
int d;
int g;
};
int arr[101][101];
V v[20];
void Sovle(int x,int y,int d,int g){
int end = pow(2,g);
// cout<<"세대 : "<<g<<endl;
arr[y][x] = 1;
// cout<<"y : "<<y<<" x : "<<x<<"\n";
for(int e=0;e<end;++e){
// cout<<"e :"<<e<<endl;
int dir = dragone[d][e];
y += dy[dir];
x += dx[dir];
// cout<<"y : "<<y<<" x : "<<x<<"\n";
arr[y][x] = 1;
}
}
int Print_solve(){
int ans=0;
for(int i=0;i<100;++i){
for(int j=0;j<100;++j){
if(arr[i][j] ==1 & arr[i][j+1] == 1 && arr[i+1][j] == 1 && arr[i+1][j+1] == 1){
ans++;
}
}
}
return ans;
}
void Make_currbe(){
dragone[0][0]=0;
dragone[1][0]=1;
dragone[2][0]=2;
dragone[3][0]=3;
for(int k=0;k<4;++k){
for(int i=1;i<=10;++i){
int start;
start = pow(2,i-1);
for(int s=start-1;s>=0;--s){
dragone[k][start++] = (dragone[k][s] +1) % 4;
}
}
}
}
int main(){
Make_currbe();
cin>>N;
for(int n =0;n<N;++n){
cin>>v[n].x>>v[n].y>>v[n].d>>v[n].g;
}
for(int n=0;n<N;++n)
Sovle(v[n].x,v[n].y,v[n].d,v[n].g);
cout<<Print_solve();
}
//0
//01
//0121
//01212321
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
반응형
'ProgramSoliving' 카테고리의 다른 글
백준 : 15683* (0) | 2020.01.21 |
---|---|
백준 : 13460* (0) | 2020.01.18 |
백준 : 2565 (0) | 2020.01.12 |
백준 : 2869 (0) | 2020.01.12 |
백준 : 17779 (0) | 2020.01.12 |