-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathCLOCKS.cpp
More file actions
43 lines (40 loc) · 719 Bytes
/
CLOCKS.cpp
File metadata and controls
43 lines (40 loc) · 719 Bytes
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
/*
USER: zobayer
PROG: CLOCKS
ALGO: pre-calculation
*/
#include <cstdio>
using namespace std;
int type[9];
int moves[9][9] = {
{3,3,3,3,3,2,3,2,0},
{2,3,2,3,2,3,1,0,1},
{3,3,3,2,3,3,0,2,3},
{2,3,1,3,2,0,2,3,1},
{2,3,2,3,1,3,2,3,2},
{1,3,2,0,2,3,1,3,2},
{3,2,0,3,3,2,3,3,3},
{1,0,1,3,2,3,2,3,2},
{0,2,3,2,3,3,3,3,3}
};
int main() {
int i, j, k;
for(i=0;i<9;i++) {
scanf("%d",&k);
switch(k) {
case 0: k =12; break;
case 1: k = 3; break;
case 2: k = 6; break;
case 3: k = 9; break;
}
for(j=0;j<9;j++) type[j] = (type[j]+(4-k/3)*moves[i][j])%4;
}
for(i=0;i<9;i++) {
for(j=0;j<type[i];j++) {
if(!(i+j)) printf("%d",i+1);
else printf(" %d",i+1);
}
}
printf("\n");
return 0;
}