Codeforces Round #352 (Div. 2)
模拟 A - Summer Camp #include <bits/stdc++.h> int a[1100]; int b[100]; int len; void init() { int i = 1, tot = 1; while (tot <= 1010) { int t = i, c = 0; while (t) { b[c++] = t % 10; t /= 10; } for (int i=c-1; i>=0; --i) { a[tot++] = b[i]; } i++; } } int main() { init (); int n; scanf ("%d", &n); printf ("%d", a[n]); return 0; } 构造 B - Different is Good 题意:问最少改变多少个字母使得该字符串的所有子串不相同 分析:子串有长度为1的,所以如果字符串长度大于26一定不可行,否则就把相同的字母用没出现的字母替换. #include <bits/stdc++.h> const int N = 1e5 + 5; char str[N]; int vis[30]; int main() { int n; scanf ("%d%s", &n, str); if (n > 26) { puts ("-1"); } else { int ans =