Codeforces Round #265 (Div. 2)_html/css_WEB-ITnose
程序员文章站
2022-06-08 22:37:59
...
Codeforces Round #265 (Div. 2)
题目链接
A:把数字变换后比较一下几个不一样即可
B:连续2个以上0当作一次操作,开头的0和结尾的0可以忽略
C:贪心从末尾去构造,由于保证一开始是回文,所以保证修改后出现回文只可能为长度2或3的,这样的话判断复杂度就很小了
D:暴力枚举情况,然后判断
E:把操作逆过来处理出每个数字对应的位数和相应数字,然后在for一遍计算答案即可
代码:
A:
#include#include int n, num[105], sb[105];char s[105];int main() { scanf("%d", &n); scanf("%s", s); for (int i = 0; i
B:
#include#include const int N = 1005;int n, num[N];int solve() { int ans = 0; int s = 0, e = n - 1; while (num[s] == 0 && s = 0) e--; for (int i = s ; i
C:
#include#include #include using namespace std;const int N = 1005;int n, p;char str[N];bool solve(int u) { if (u = 0 && str[u] == str[u - 1]) return solve(u); if (u - 2 >= 0 && str[u] == str[u - 2]) return solve(u); return true; }}int main() { scanf("%d%d", &n, &p); scanf("%s", str); if (solve(n - 1)) printf("%s\n", str); else printf("NO\n"); return 0;}
D:
#include#include #include #include #include #include using namespace std;struct Point { int v[3]; void read() { for (int i = 0; i
E:
#include#include #include #include using namespace std;typedef long long ll;const ll MOD = 1000000007;const int N = 100005;char str[N], sss[N];int n;ll pow_mod(ll x, ll k) { ll ans = 1; while (k) { if (k&1) ans = (ans * x) % MOD; x = x * x % MOD; k >>= 1; } return ans;}ll v[15], l[15];ll idx(char c) { return c - '0';}struct State { ll u; vector v; void init(char *str) { int len = strlen(str); u = idx(str[0]); v.clear(); for (int i = 3; i = 0; i--) { ll lt = 0, vt = 0; for (int j = 0; j
推荐阅读
-
Educational Codeforces Round 37 (Rated for Div. 2) E. Connected Components?(图论+连通块+bfs)
-
Educational Codeforces Round 66 (Rated for Div. 2)-E. Minimal Segment Cover
-
Educational Codeforces Round 65 (Rated for Div. 2) E. Range Deleting(双指针+思维)
-
Educational Codeforces Round 66 (Rated for Div. 2) E. Minimal Segment Cover 倍增
-
Codeforces Round #226 (Div. 2)
-
Codeforces Round #FF (Div. 2) D. DZY Loves Modification 贪心+优先队列_html/css_WEB-ITnose
-
Codeforces Round #266 (Div. 2) B. Wonder Room_html/css_WEB-ITnose
-
Codeforces Round #258 (Div. 2)Devu and Flowers 容斥原理_html/css_WEB-ITnose
-
Codeforces Round #595 (Div. 3)D1D2 贪心 STL
-
Codeforces Round #655 (Div. 2) A. Omkar and Completion