forked from USTC-Hackergame/hackergame2021-writeups
-
Notifications
You must be signed in to change notification settings - Fork 0
/
14.wl
53 lines (38 loc) · 1.92 KB
/
14.wl
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
(* ::Package:: *)
(* ::Section:: *)
(*target*)
(* ::Input:: *)
(*n=12;*)
(* ::Input:: *)
(*target=\!\(\**)
(*TagBox[*)
(*RowBox[{"(", GridBox[{*)
(*{"189", "189", "189", "189", "189", "33", "33", "33", "189", "189", "189", "189"},*)
(*{"189", "189", "189", "33", "33", "33", "189", "33", "44", "189", "189", "189"},*)
(*{"189", "189", "189", "189", "189", "33", "33", "33", "33", "189", "189", "189"},*)
(*{"189", "189", "189", "189", "189", "33", "189", "33", "33", "189", "189", "189"},*)
(*{"189", "189", "189", "33", "33", "189", "189", "33", "33", "33", "189", "189"},*)
(*{"189", "134", "33", "33", "189", "189", "189", "189", "33", "33", "189", "189"},*)
(*{"189", "144", "33", "33", "189", "189", "189", "189", "33", "189", "189", "189"},*)
(*{"189", "142", "33", "33", "189", "189", "189", "189", "33", "33", "33", "189"},*)
(*{"189", "100", "142", "33", "189", "189", "189", "189", "33", "33", "33", "189"},*)
(*{"189", "142", "142", "189", "189", "189", "189", "189", "189", "33", "189", "189"},*)
(*{"189", "59", "142", "33", "189", "189", "189", "189", "33", "189", "189", "189"},*)
(*{"189", "189", "33", "33", "189", "189", "189", "189", "189", "189", "189", "189"}*)
(*},*)
(*GridBoxAlignment->{"Columns" -> {{Center}}, "Rows" -> {{Baseline}}},*)
(*GridBoxSpacings->{"Columns" -> {Offset[0.27999999999999997`], {Offset[0.7]}, Offset[0.27999999999999997`]}, "Rows" -> {Offset[0.2], {Offset[0.4]}, Offset[0.2]}}], ")"}],*)
(*Function[BoxForm`e$, MatrixForm[BoxForm`e$]]]\);*)
(* ::Section:: *)
(*1*)
(* ::Input:: *)
(*g[x_,y_]:=3t[x,y]+2(t[x-1,y]+t[x,y-1]+t[x+1,y]+t[x,y+1])+t[x-2,y]+t[x,y-2]+t[x+2,y]+t[x,y+2]//Expand*)
(* ::Input:: *)
(*t[x_,y_]:=If[1<=x<=n&&1<=y<=n,c[x,y],0];*)
(* ::Input:: *)
(*allC=Flatten@Table[c[i,j],{i,n},{j,n}];*)
(*eqns=Simplify@Flatten@Table[g[x,y]==target[[x,y]],{x,n},{y,n}];*)
(* ::Input:: *)
(*solution=allC/.FindInstance[eqns,allC,Modulus->256][[1]];*)
(*ans=Partition[solution,n];*)
(*ans//MatrixForm*)