本来想一次补完的(正常应该补两次的)但是晚上玩dota2和rpg去了然后……又堕落了啊。
好吧进入正题,题目按照从易到难的顺序(个人感觉)其他题目现在对我来说太难了,以后再补。
A题 ZOJ 3878 水题,可以用map一个一个对应,比较麻烦就用了两个字符数组,要注意\和“要转义。
1 #include<cstdio>
2 #include<cstring>
3 #include<iostream>
4 #include<algorithm>
5 #include<cmath>
6 #include<vector>
7 #include<set>
8 #include<string>
9 #include<sstream>
10 #include<cctype>
11 #include<map>
12 #include<stack>
13 #include<queue>
14 using namespace std;
15 #define INF 0x3f3f3f3f
16 typedef long long ll;
17 int gcd(int a, int b){return b==0?a:gcd(b,a%b);}
18
19 char s1[] = "~!@#$%^&*()_+`1234567890-=qwertyuiop[]\\QWERTYUIOP{}|asdfghjkl;'ASDFGHJKL:\"zxcvbnm,./ZXCVBNM<>?";
20 char s2[] = "~!@#$%^&*(){}`1234567890[]',.pyfgcrl/=\\\"<>PYFGCRL?+|aoeuidhtns-AOEUIDHTNS_;qjkxbmwvz:QJKXBMWVZ";
21
22 char fun(char c)
23 {
24 for(int i = 0; s1[i]; i++)
25 if(s1[i] == c)
26 return s2[i];
27 return c;
28 }
29
30 int main()
31 {
32 // freopen("input.txt", "r", stdin);
33 // freopen("output.txt", "w", stdout);
34 char c;
35 while(~scanf("%c", &c))
36 printf("%c", fun(c));
37 return 0;
38 }
View Code
G题 gym 101156L 也算水题吧,毕竟我这种渣渣也能在训练的时候一次AC,没啥技巧,就是模拟。
1 #include<cstdio>
2 #include<cstring>
3 #include<iostream>
4 #include<algorithm>
5 #include<cmath>
6 #include<vector>
7 #include<set>
8 #include<string>
9 #include<sstream>
10 #include<cctype>
11 #include<map>
12 #include<stack>
13 #include<queue>
14 using namespace std;
15 #define INF 0x3f3f3f3f
16 int gcd(int a, int b){return b==0?a:gcd(b,a%b);}
17
18 int s[25][25];
19
20 int main()
21 {
22 //freopen("input.txt", "r", stdin);
23 //freopen("output.txt", "w", stdout);
24 int T, n;
25 char a[5];
26 scanf("%d", &T);
27 while(T--)
28 {
29 scanf("%d", &n);
30 scanf("%s", a);
31 for(int i = 1; i <= n; i++)
32 for(int j = 1; j <= n; j++)
33 scanf("%d", &s[i][j]);
34 if(a[0] == 'r')
35 {
36 for(int i = 1; i <= n; i++)
37 {
38 for(int j = n; j >= 1; j--)
39 {
40 for(int k = j - 1; k >= 1; k--)
41 {
42 if(s[i][j] == s[i][k])
43 {
44 s[i][j] *= 2;
45 s[i][k] = 0;
46 break;
47 }
48 else
49 {
50 if(s[i][k]) break;
51 }
52 }
53 }
54 for(int j = n; j >= 1; j--)
55 {
56 if(s[i][j]) continue;
57 else
58 {
59 for(int k = j - 1; k >= 1; k--)
60 {
61 if(s[i][k])
62 {
63 s[i][j] = s[i][k];
64 s[i][k] = 0;
65 break;
66 }
67 }
68 }
69 }
70 }
71 }
72 else if(a[0] == 'l')
73 {
74 for(int i = 1; i <= n; i++)
75 {
76 for(int j = 1; j <= n; j++)
77 {
78 for(int k = j + 1; k <= n; k++)
79 {
80 if(s[i][j] == s[i][k])
81 {
82 s[i][j] *= 2;
83 s[i][k] = 0;
84 break;
85 }
86 else
87 {
88 if(s[i][k]) break;
89 }
90 }
91 }
92 for(int j = 1; j <= n; j++)
93 {
94 if(s[i][j]) continue;
95 else
96 {
97 for(int k = j + 1; k <= n; k++)
98 {
99 if(s[i][k])
100 {
101 s[i][j] = s[i][k];
102 s[i][k] = 0;
103 break;
104 }
105 }
106 }
107 }
108 }
109 }
110 else if(a[0] == 'd')
111 {
112 for(int i = 1; i <= n; i++)
113 {
114 for(int j = n; j >= 1; j--)
115 {
116 for(int k = j - 1; k >= 1; k--)
117 {
118 if(s[j][i] == s[k][i])
119 {
120 s[j][i] *= 2;
121 s[k][i] = 0;
122 break;
123 }
124 else
125 {
126 if(s[k][i]) break;
127 }
128 }
129 }
130 for(int j = n; j >= 1; j--)
131 {
132 if(s[j][i]) continue;
133 else
134 {
135 for(int k = j - 1; k >= 1; k--)
136 {
137 if(s[k][i])
138 {
139 s[j][i] = s[k][i];
140 s[k][i] = 0;
141 break;
142 }
143 }
144 }
145 }
146 }
147 }
148 else
149 {
150 for(int i = 1; i <= n; i++)
151 {
152 for(int j = 1; j <= n; j++)
153 {
154 for(int k = j + 1; k <= n; k++)
155 {
156 if(s[j][i] == s[k][i])
157 {
158 s[j][i] *= 2;
159 s[k][i] = 0;
160 break;
161 }
162 else
163 {
164 if(s[k][i]) break;
165 }
166 }
167 }
168 for(int j = 1; j <= n; j++)
169 {
170 if(s[j][i]) continue;
171 else
172 {
173 for(int k = j + 1; k <= n; k++)
174 {
175 if(s[k][i])
176 {
177 s[j][i] = s[k][i];
178 s[k][i] = 0;
179 break;
180 }
181 }
182 }
183 }
184 }
185 }
186 for(int i = 1; i <= n; i++)
187 {
188 printf("%d", s[i][1]);
189 for(int j = 2; j <= n; j++)
190 printf(" %d", s[i][j]);
191 printf("\n");
192 }
193 }
194 return 0;
195 }
View Code
水平太差,题目补得有点少,还都是水题。
明天继续加油!!!