待补

A


  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int n;
  4. int main()
  5. {
  6. int __;
  7. scanf("%d", &__);
  8. while(__ -- )
  9. {
  10. scanf("%d", &n);
  11. if(n == 1) printf("0\n");
  12. else if(n == 2) printf("1\n");
  13. else if(n == 3) printf("2\n");
  14. else if(n % 2 == 0) printf("2\n");
  15. else printf("3\n");
  16. }
  17. return 0;
  18. }

B


  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int N = 100 + 20;
  4. int n, q;
  5. char str[N];
  6. int main()
  7. {
  8. int __;
  9. scanf("%d", &__);
  10. while(__ -- )
  11. {
  12. scanf("%d%d", &n, &q);
  13. scanf("%s", str + 1);
  14. while(q -- )
  15. {
  16. int l, r;
  17. scanf("%d%d", &l, &r);
  18. int flag = 0;
  19. for(int i = 1; i < l; ++ i)
  20. if(str[i] == str[l])
  21. flag = 1;
  22. for(int i = r + 1; i <= n; ++ i)
  23. if(str[i] == str[r])
  24. flag = 1;
  25. if(flag) printf("YES\n");
  26. else printf("NO\n");
  27. }
  28. }
  29. return 0;
  30. }

C


  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int N = 2e6 + 10;
  4. int n, k;
  5. char a[N], b[N];
  6. int ca[30], cb[30];
  7. int main()
  8. {
  9. int __;
  10. scanf("%d", &__);
  11. while(__ -- )
  12. {
  13. for(int i = 0; i < 26; ++ i)
  14. ca[i] = cb[i] = 0;
  15. scanf("%d%d", &n, &k);
  16. scanf("%s%s", a + 1, b + 1);
  17. for(int i = 1; i <= n; ++ i) ca[a[i] - 'a'] ++;
  18. for(int i = 1; i <= n; ++ i) cb[b[i] - 'a'] ++;
  19. int flag = 0;
  20. for(int i = 0; i < 26; ++ i)
  21. {
  22. if(ca[i] < cb[i]) { flag = 1; break;}
  23. if((ca[i] - cb[i]) % k == 0)
  24. ca[i + 1] = ca[i + 1] + ca[i] - cb[i];
  25. else {flag = 1; break;}
  26. }
  27. if(flag) puts("No");
  28. else puts("Yes");
  29. }
  30. return 0;
  31. }

D


  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. typedef long long LL;
  4. LL d, k;
  5. int main()
  6. {
  7. int __;
  8. scanf("%d", &__);
  9. while(__ -- )
  10. {
  11. scanf("%lld%lld", &d, &k);
  12. LL x = 0, y = 0, res = 0;
  13. while(x * x + y * y <= d * d)
  14. {
  15. if(x < y) x += k;
  16. else y += k;
  17. res ++;
  18. }
  19. if(res % 2 == 0) puts("Ashish");
  20. else puts("Utkarsh");
  21. }
  22. return 0;
  23. }

E1/E2


  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. const int N = 1 << 17;
  4. int n, v[N], from[N], a[N];
  5. int query(int op, int i, int j)
  6. {
  7. if(op == 1) printf("AND");
  8. if(op == 2) printf("XOR");
  9. printf(" %d %d\n", i, j); fflush(stdout);
  10. int x;
  11. scanf("%d", &x);
  12. return x;
  13. }
  14. void print()
  15. {
  16. printf("!");
  17. for(int i = 1; i <= n; ++ i) printf(" %d", a[i]);
  18. puts("");
  19. }
  20. void f(int x, int y)
  21. {
  22. a[x] = a[y] = query(1, x, y);
  23. a[1] = v[x] ^ a[x];
  24. for(int i = 2; i <= n; ++ i)
  25. a[i] = a[1] ^ v[i];
  26. print();
  27. }
  28. void g(int x, int y)
  29. {
  30. int v1 = query(1, 1, x);
  31. int v2 = query(1, 1, y);
  32. for(int i = 0; i < 16; ++ i)
  33. {
  34. int u = 0;
  35. if(i == 0) u = (v2 >> i) & 1;
  36. else u = (v1 >> i) & 1;
  37. a[1] |= u << i;
  38. for(int j = 2; j <= n; ++ j)
  39. a[j] |= (u ^ ((v[j] >> i) & 1)) << i;
  40. }
  41. print();
  42. }
  43. int main()
  44. {
  45. scanf("%d", &n);
  46. for(int i = 2; i <= n; ++ i) v[i] = query(2, 1, i);
  47. for(int i = 2; i <= n; ++ i)
  48. if(!v[i]) { f(1, i); return 0; }
  49. for(int i = 2; i <= n; ++ i)
  50. if(!from[v[i]]) from[v[i]] = i;
  51. else { f(from[v[i]], i); return 0; }
  52. g(from[1], from[2]);
  53. return 0;
  54. }

2020.11.23

Codeforces Round #685 (Div. 2)的更多相关文章

  1. Codeforces Round #366 (Div. 2) ABC

    Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...

  2. Codeforces Round #354 (Div. 2) ABCD

    Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/out ...

  3. Codeforces Round #368 (Div. 2)

    直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输 ...

  4. cf之路,1,Codeforces Round #345 (Div. 2)

     cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅.....   ...

  5. Codeforces Round #279 (Div. 2) ABCDE

    Codeforces Round #279 (Div. 2) 做得我都变绿了! Problems     # Name     A Team Olympiad standard input/outpu ...

  6. Codeforces Round #262 (Div. 2) 1003

    Codeforces Round #262 (Div. 2) 1003 C. Present time limit per test 2 seconds memory limit per test 2 ...

  7. Codeforces Round #262 (Div. 2) 1004

    Codeforces Round #262 (Div. 2) 1004 D. Little Victor and Set time limit per test 1 second memory lim ...

  8. Codeforces Round #371 (Div. 1)

    A: 题目大意: 在一个multiset中要求支持3种操作: 1.增加一个数 2.删去一个数 3.给出一个01序列,问multiset中有多少这样的数,把它的十进制表示中的奇数改成1,偶数改成0后和给 ...

  9. Codeforces Round #268 (Div. 2) ABCD

    CF469 Codeforces Round #268 (Div. 2) http://codeforces.com/contest/469 开学了,时间少,水题就不写题解了,不水的题也不写这么详细了 ...

随机推荐

  1. 设计模式(十八)——观察者模式(JDK Observable源码分析)

    1 天气预报项目需求,具体要求如下: 1) 气象站可以将每天测量到的温度,湿度,气压等等以公告的形式发布出去(比如发布到自己的网站或第三方). 2) 需要设计开放型 API,便于其他第三方也能接入气象 ...

  2. WSL2 准备dotnet core开发环境

    首先我们要知道WSL Ubuntu的版本,以便进行下一步操作: 我的是18.04,所以安装dot net SDK我们参考这里: https://docs.microsoft.com/en-us/dot ...

  3. 关于markdown的入门使用

    关于标题 方式一: 使用 = - 标示一,二级标题 = 表示一级标题 - 表示二级标题 示例: 我展示的是一级标题 ================= 我展示的是二级标题 -------------- ...

  4. Jpress小程序

    首页轮播.首页公告.首页宫格.个人中心页面均支持在PC后台设置内容 首页列表.分类列表页.搜索列表的文章展示页均支持后台设置,拥有三种风格 所有分类展示支持两种风格 用户中心授权登陆,查看个人数据 J ...

  5. RuntimeError already started

    Env: os: Ubuntu python3 pytorch vscode Desc 在上述环境中运行A3C多进程模型,使用命令行时没问题,使用vscode时出现 'RuntimeError: al ...

  6. k8s二进制部署 - 总结

    镜像仓库: 安装软件:docker.docker-compose.harbor.nginx 1.下载cfssl.cfssljson.cfssl-certinfo,增加执行权限并放在PATH环境变量路径 ...

  7. zookeeper 的监控指标(一)

    一 应用场景描述 在目前公司的业务中,没有太多使用ZooKeeper作为协同服务的场景.但是我们将使用Codis作为Redis的集群部署方案,Codis依赖ZooKeeper来存储配置信息.所以做好Z ...

  8. pycharm 与 anaconda 关联

    anaconda Anaconda指的是一个开源的Python发行版本,集成了许多数据分析的库. 使用tersorflow进行机器学习时常用Anaconda pycharm PyCharm是一种Pyt ...

  9. TCP之“3次握手,4次挥手”问题——实例分析

    上一篇我们分析了三次握手和四次握手的过程,但是理论分析难免枯燥难懂,下面这篇我们来看一个例子,就能更好地理解tcp链接了. 我们可以通过网络抓包的查看具体的流程: 比如我们服务器开启9502的端口.使 ...

  10. Leetcode(104)-二叉树的最大深度

    给定一个二叉树,找出其最大深度. 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数. 说明: 叶子节点是指没有子节点的节点. 示例:给定二叉树 [3,9,20,null,null,15,7], ...