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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
| #include <cstdio>
struct TRI { int x1, y1, x2, y2, x3, y3; };
void print(TRI t) { printf("%d %d %d %d %d %d\n", t.x1, t.y1, t.x2, t.y2, t.x3, t.y3); }
void solve(TRI t, int n) { if (n == 0) { print(t); return; } TRI a = { t.x1,t.y1, (t.x1 + t.x2) / 2,(t.y1 + t.y2) / 2, (t.x1 + t.x3) / 2,(t.y1 + t.y3) / 2 }; TRI b = { t.x2,t.y2, (t.x2 + t.x3) / 2,(t.y2 + t.y3) / 2, (t.x2 + t.x1) / 2,(t.y2 + t.y1) / 2 }; TRI c = { t.x3,t.y3, (t.x3 + t.x1) / 2,(t.y3 + t.y1) / 2, (t.x3 + t.x2) / 2,(t.y3 + t.y2) / 2 }; TRI d = { (t.x3 + t.x1) / 2,(t.y3 + t.y1) / 2, (t.x3 + t.x2) / 2,(t.y3 + t.y2) / 2, (t.x2 + t.x1) / 2,(t.y2 + t.y1) / 2 };
print(b); print(c); print(d); solve(a, n - 3); }
int main() { int n; scanf("%d", &n); if (n < 8) { printf("No\n"); return 0; }
printf("Yes\n"); if (n % 3 == 2) { TRI tri[] = { { 0,0, 450000000,800000000, 0,1000000000 }, { 0,0, 450000000,800000000, 500000000,0 }, { 0,1000000000, 500000000,1000000000, 450000000,800000000 }, { 500000000,0, 450000000,800000000, 550000000,800000000 }, { 500000000,0, 1000000000,0, 550000000,800000000 }, { 1000000000,1000000000, 1000000000,0, 550000000,800000000 }, { 1000000000,1000000000, 500000000,1000000000, 550000000,800000000 }, { 550000000,800000000, 500000000,1000000000, 450000000,800000000 }, };
if (n >= 44) { for (int i = 3; i < 8; ++i) { print(tri[i]); } solve(tri[0], 12); solve(tri[1], 12); solve(tri[2], n - 12 - 12 - 8); } else if (n >= 32) { for (int i = 2; i < 8; ++i) { print(tri[i]); } solve(tri[0], 12); solve(tri[1], n - 20); } else { for (int i = 1; i < 8; ++i) { print(tri[i]); } solve(tri[0], n - 8);
} } if (n % 3 == 0) { TRI tri[] = { { 0, 1000000000, 1000000000, 1000000000, 850000000, 200000000 }, { 0, 1000000000, 850000000, 200000000, 0,0 }, { 784557000, 0, 765000000, 180000000, 0,0 }, { 1000000000, 1000000000, 1000000000, 176901000, 850000000, 200000000 }, { 850000000, 200000000, 1000000000, 176901000, 865600000, 125700000 }, { 865600000, 125700000, 1000000000, 176901000, 1000000000, 0 }, { 865600000, 125700000, 784557000, 0, 1000000000, 0 }, { 865600000, 125700000, 784557000, 0, 765000000, 180000000 }, { 865600000, 125700000, 850000000, 200000000, 765000000, 180000000 }, };
if (n >= 45) { for (int i = 4; i < 9; ++i) { print(tri[i]); } solve(tri[0], 12); solve(tri[1], 12); solve(tri[2], 6); solve(tri[3], n - 12 - 6 - 12 - 9); } else if (n >= 33) { for (int i = 2; i < 9; ++i) { print(tri[i]); } solve(tri[0], 12); solve(tri[1], n - 21); } else { for (int i = 1; i < 9; ++i) { print(tri[i]); } solve(tri[0], n - 9); }
} if (n % 3 == 1) { TRI tri[] = { { 1000000000, 1000000000, 500000000, 800000000, 1000000000, 0 }, { 0, 1000000000, 500000000, 800000000, 0,0 }, { 0, 0, 500000000, 800000000, 1000000000, 0 }, { 0, 1000000000, 420000000,1000000000, 400000000, 840000000 }, { 500000000, 900000000, 420000000,1000000000, 400000000, 840000000 }, { 500000000, 900000000, 420000000,1000000000, 580000000,1000000000 }, { 500000000, 900000000, 600000000, 840000000, 580000000,1000000000 }, { 500000000, 900000000, 600000000, 840000000, 500000000, 800000000 }, { 500000000, 900000000, 400000000, 840000000, 500000000, 800000000 }, { 1000000000, 1000000000, 600000000, 840000000, 580000000,1000000000 }, };
if (n >= 34) { for (int i = 3; i < 10; ++i) { print(tri[i]); } solve(tri[0], 12); solve(tri[1], 12); solve(tri[2], n - 12 - 12 - 10); } else { for (int i = 1; i < 10; ++i) { print(tri[i]); } solve(tri[0], n - 10); } } return 0; }
|