Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int n,m,k;
  5. ;
  6.  
  7. int main()
  8. {
  9. cin>>n>>m>>k;
  10. ;i<=k-;++i) {
  11. sum+=(n+(m-))*-(i)*;
  12. }
  13. cout<<sum<<endl;
  14. }

A - Golden Plate

一个三维数组确定一条路径,直接搜就行

  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<cstdlib>
  5. #include<cstring>
  6. #include<cmath>
  7. #include<algorithm>
  8. #include<queue>
  9. #include<vector>
  10. #include<map>
  11. #define lson i<<1
  12. #define rson i<<1|1
  13. #define LS l,mid,lson
  14. #define RS mid+1,r,rson
  15. #define mem(a,x) memset(a,x,sizeof(a))
  16. #define gcd(a,b) __gcd(a,b)
  17. #define ll long long
  18. #define ull unsigned long long
  19. #define lowbit(x) (x&-x)
  20. #define pb(x) push_back(x)
  21. #define enld endl
  22. #define mian main
  23. #define itn int
  24. #define prinft printf
  25. #pragma GCC optimize(2)
  26. //#pragma comment(linker, "/STACK:102400000,102400000")
  27.  
  28. const double PI = acos (-1.0);
  29. const int INF = 0x3f3f3f3f;
  30. ;
  31. ;
  32. ;
  33. ;
  34.  
  35. using namespace std;
  36.  
  37. int n,cnt,temp;
  38. int a[MAXN],b[MAXN],ans[MAXN];
  39. //int a,b;
  40. ][][];
  41.  
  42. void init() {
  43. mem(t,-);
  44. t[][][]=,t[][][]=;
  45. t[][][]=,t[][][]=;
  46. t[][][]=,t[][][]=;
  47. t[][][]=,t[][][]=;
  48. t[][][]=,t[][][]=;
  49. t[][][]=,t[][][]=;
  50. t[][][]=,t[][][]=;
  51. t[][][]=,t[][][]=;
  52. t[][][]=,t[][][]=;
  53. t[][][]=,t[][][]=;
  54. }
  55.  
  56. int main() {
  57. std::ios::sync_with_stdio(false);
  58. cin.tie(NULL);
  59. init();
  60. while(cin>>n) {
  61. mem(ans,-);
  62. ; i<=n-; ++i) {
  63. cin>>a[i];
  64. }
  65. ; i<=n-; ++i) {
  66. cin>>b[i];
  67. }
  68. ; i<=; ++i) {
  69. temp=i;
  70. cnt=;
  71. ans[++cnt]=temp;
  72. ; j<=n-; ++j) {
  73. //cerr<<'#'<<a[j]<<' '<<b[j]<<' '<<temp<<' '<<t[a[j]][b[j]][temp]<<endl;
  74. ) {
  75. temp=t[a[j]][b[j]][temp];
  76. ans[++cnt]=temp;
  77. } else {
  78. cnt=;
  79. break;
  80. }
  81. }
  82. if(cnt==n)
  83. break;
  84. }
  85. if(cnt==n) {
  86. cout<<"YES"<<endl;
  87. ; i<=n; ++i) {
  88. )
  89. cout<<' ';
  90. cout<<ans[i];
  91. }
  92. cout<<endl;
  93. } else
  94. cout<<"NO"<<endl;
  95. }
  96.  
  97. ;
  98. }

B - Curiosity Has No Limits

二分+贪心(只要n在a+b的范围内,所有的数都可以放进去)

  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<cstdlib>
  5. #include<cstring>
  6. #include<cmath>
  7. #include<algorithm>
  8. #include<queue>
  9. #include<vector>
  10. #include<map>
  11. #define lson i<<1
  12. #define rson i<<1|1
  13. #define LS l,mid,lson
  14. #define RS mid+1,r,rson
  15. #define mem(a,x) memset(a,x,sizeof(a))
  16. #define gcd(a,b) __gcd(a,b)
  17. #define ll long long
  18. #define ull unsigned long long
  19. #define lowbit(x) (x&-x)
  20. #define pb(x) push_back(x)
  21. #define enld endl
  22. #define mian main
  23. #define itn int
  24. #define prinft printf
  25. #pragma GCC optimize(2)
  26. //#pragma comment(linker, "/STACK:102400000,102400000")
  27.  
  28. const double PI = acos (-1.0);
  29. const int INF = 0x3f3f3f3f;
  30. ;
  31. ;
  32. ;
  33. ;
  34.  
  35. using namespace std;
  36.  
  37. ll a,b,n,m;
  38.  
  39. bool check(ll m) {
  40. )/>(a+b))
  41. return true;
  42. else
  43. return false;
  44. }
  45.  
  46. ll ans1[MAXN],ans2[MAXN];
  47.  
  48. int main() {
  49. //std::ios::sync_with_stdio(false);
  50. //cin.tie(NULL);
  51.  
  52. while(cin>>a>>b) {
  53. ll l=-,r=*sqrt(a+b);
  54. ; i<=; ++i) {
  55. m=(l+r)/;
  56. if(check(m))
  57. r=m-;
  58. else
  59. n=m,l=m+;
  60. }
  61. cerr<<n<<endl;
  62. ll cnt1=,cnt2=;
  63. ; i--) {
  64. if(i<=a) {
  65. ans1[++cnt1]=i;
  66. a-=i;
  67. } else {
  68. ans2[++cnt2]=i;
  69. b-=i;
  70. }
  71. }
  72.  
  73. cout<<cnt1<<endl;
  74. ; i<=cnt1; ++i) {
  75. )
  76. cout<<' ';
  77. cout<<ans1[i];
  78. }
  79. cout<<endl<<cnt2<<endl;
  80. ; i<=cnt2; ++i) {
  81. )
  82. cout<<' ';
  83. cout<<ans2[i];
  84. }
  85. cout<<endl;
  86.  
  87. }
  88.  
  89. ;
  90. }

C - Cram Time

Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)的更多相关文章

  1. Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) D. Minimum path

    http://codeforces.com/contest/1072/problem/D bfs 走1步的最佳状态 -> 走2步的最佳状态 -> …… #include <bits/ ...

  2. Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) D. Minimum path(字典序)

    https://codeforces.com/contest/1072/problem/D 题意 给你一个n*n充满小写字母的矩阵,你可以更改任意k个格子的字符,然后输出字典序最小的从[1,1]到[n ...

  3. Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)D(思维,DP,字符串)

    #include<bits/stdc++.h>using namespace std;char c[2007][2007];char ans[4007];int s[2007][2007] ...

  4. (AB)Codeforces Round #528 (Div. 2, based on Technocup 2019 Elimination Round

    A. Right-Left Cipher time limit per test 1 second memory limit per test 256 megabytes input standard ...

  5. Codeforces Round #528 (Div. 2, based on Technocup 2019 Elimination Round 4) C. Connect Three 【模拟】

    传送门:http://codeforces.com/contest/1087/problem/C C. Connect Three time limit per test 1 second memor ...

  6. Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1) C. Vasya and Golden Ticket 【。。。】

    任意门:http://codeforces.com/contest/1058/problem/C C. Vasya and Golden Ticket time limit per test 1 se ...

  7. Codeforces Round #512 (Div. 2, based on Technocup 2019 Elimination Round 1) E. Vasya and Good Sequences(DP)

    题目链接:http://codeforces.com/contest/1058/problem/E 题意:给出 n 个数,对于一个选定的区间,区间内的数可以通过重新排列二进制数的位置得到一个新的数,问 ...

  8. Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3)B. Personalized Cup

    题意:把一长串字符串 排成矩形形式  使得行最小  同时每行不能相差大于等于两个字符 每行也不能大于20个字符 思路: 因为使得行最小 直接行从小到大枚举即可   每行不能相差大于等于两个字符相当于  ...

  9. Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3) C. Playing Piano

    题意:给出一个数列 a1 a2......an  让你构造一个序列(该序列取值(1-5)) 如果a(i+1)>a(i) b(i+1)>b(i) 如果a(i+1)<a(i)  那么b( ...

随机推荐

  1. bzoj千题计划232:bzoj4727: [POI2017]Turysta

    http://www.lydsy.com/JudgeOnline/problem.php?id=4727 竞赛图tarjan缩点后得到的拓扑图一定是一条链 因为竞赛图任意两点的前后顺序确定,只有一种拓 ...

  2. Sublime Text 3 绿色汉化版 x64

    之前做了<Sublime Text 2 绿色汉化版 x64>,这些天抽空做了下 ST3 的汉化.. 果然我没有任何理由爱上 ST3,不仅pojie麻烦,而且汉化更麻烦,菜单字符长度做了限制 ...

  3. 第9月第6天 push pop动画 生成器模式(BUILDER)

    1. https://github.com/MichaelHuyp/QQNews 2.生成器模式(BUILDER) class MazeBuilder { public: virtual void B ...

  4. 底板芯片组与内存映射(Motherboard Chipsets and the Memory Map) 【转】

    转自:http://blog.chinaunix.net/uid-25909619-id-4194650.html 底板芯片组与内存映射 我打算写一些关于计算机内部构造(computer intern ...

  5. 设置linux的console为串口【转】

    转自:http://blog.chinaunix.net/uid-27717694-id-4074219.html 以Grub2为例:1. 修改文件/etc/default/grub   #显示启动菜 ...

  6. 【mac】7z 终端命令行

    链接:http://www.2cto.com/os/201410/341079.html 7z指令 7z是7zip压缩工具的常用压缩文件格式.7zip是一个开源的压缩工具,软件本身十分小巧,功能强大, ...

  7. 网络抓包神器-Charles使用指南

    http://blog.csdn.net/liulanghk/article/details/46342205 目录 概述 安装 显示模式 PC端抓包 移动应用抓包 其他技能 charles使用问题汇 ...

  8. mysql添加事件

    begin declare debug int; set @debug = 0; if @debug = 1 then insert into task_monitor(info) values('s ...

  9. javaweb笔记四

    得到表单数据:1.String str = request.getParameter(String)//根据表单名得到表单值,如果是多个同名的键值,返回第一个值.2.String[] str= req ...

  10. /dev/null和/dev/zero的区别

    /dev/null,外号叫无底洞,你可以向它输出任何数据,它通吃,并且不会撑着!/dev/zero,是一个输入设备,你可你用它来初始化文件. /dev/null------它是空设备,也称为位桶(bi ...