Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)
Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) |
---|
- #include <bits/stdc++.h>
- using namespace std;
- int n,m,k;
- ;
- int main()
- {
- cin>>n>>m>>k;
- ;i<=k-;++i) {
- sum+=(n+(m-))*-(i)*;
- }
- cout<<sum<<endl;
- }
A - Golden Plate
一个三维数组确定一条路径,直接搜就行
- #include<bits/stdc++.h>
- #include<iostream>
- #include<cstdio>
- #include<cstdlib>
- #include<cstring>
- #include<cmath>
- #include<algorithm>
- #include<queue>
- #include<vector>
- #include<map>
- #define lson i<<1
- #define rson i<<1|1
- #define LS l,mid,lson
- #define RS mid+1,r,rson
- #define mem(a,x) memset(a,x,sizeof(a))
- #define gcd(a,b) __gcd(a,b)
- #define ll long long
- #define ull unsigned long long
- #define lowbit(x) (x&-x)
- #define pb(x) push_back(x)
- #define enld endl
- #define mian main
- #define itn int
- #define prinft printf
- #pragma GCC optimize(2)
- //#pragma comment(linker, "/STACK:102400000,102400000")
- const double PI = acos (-1.0);
- const int INF = 0x3f3f3f3f;
- ;
- ;
- ;
- ;
- using namespace std;
- int n,cnt,temp;
- int a[MAXN],b[MAXN],ans[MAXN];
- //int a,b;
- ][][];
- void init() {
- mem(t,-);
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- t[][][]=,t[][][]=;
- }
- int main() {
- std::ios::sync_with_stdio(false);
- cin.tie(NULL);
- init();
- while(cin>>n) {
- mem(ans,-);
- ; i<=n-; ++i) {
- cin>>a[i];
- }
- ; i<=n-; ++i) {
- cin>>b[i];
- }
- ; i<=; ++i) {
- temp=i;
- cnt=;
- ans[++cnt]=temp;
- ; j<=n-; ++j) {
- //cerr<<'#'<<a[j]<<' '<<b[j]<<' '<<temp<<' '<<t[a[j]][b[j]][temp]<<endl;
- ) {
- temp=t[a[j]][b[j]][temp];
- ans[++cnt]=temp;
- } else {
- cnt=;
- break;
- }
- }
- if(cnt==n)
- break;
- }
- if(cnt==n) {
- cout<<"YES"<<endl;
- ; i<=n; ++i) {
- )
- cout<<' ';
- cout<<ans[i];
- }
- cout<<endl;
- } else
- cout<<"NO"<<endl;
- }
- ;
- }
B - Curiosity Has No Limits
二分+贪心(只要n在a+b的范围内,所有的数都可以放进去)
- #include<bits/stdc++.h>
- #include<iostream>
- #include<cstdio>
- #include<cstdlib>
- #include<cstring>
- #include<cmath>
- #include<algorithm>
- #include<queue>
- #include<vector>
- #include<map>
- #define lson i<<1
- #define rson i<<1|1
- #define LS l,mid,lson
- #define RS mid+1,r,rson
- #define mem(a,x) memset(a,x,sizeof(a))
- #define gcd(a,b) __gcd(a,b)
- #define ll long long
- #define ull unsigned long long
- #define lowbit(x) (x&-x)
- #define pb(x) push_back(x)
- #define enld endl
- #define mian main
- #define itn int
- #define prinft printf
- #pragma GCC optimize(2)
- //#pragma comment(linker, "/STACK:102400000,102400000")
- const double PI = acos (-1.0);
- const int INF = 0x3f3f3f3f;
- ;
- ;
- ;
- ;
- using namespace std;
- ll a,b,n,m;
- bool check(ll m) {
- )/>(a+b))
- return true;
- else
- return false;
- }
- ll ans1[MAXN],ans2[MAXN];
- int main() {
- //std::ios::sync_with_stdio(false);
- //cin.tie(NULL);
- while(cin>>a>>b) {
- ll l=-,r=*sqrt(a+b);
- ; i<=; ++i) {
- m=(l+r)/;
- if(check(m))
- r=m-;
- else
- n=m,l=m+;
- }
- cerr<<n<<endl;
- ll cnt1=,cnt2=;
- ; i--) {
- if(i<=a) {
- ans1[++cnt1]=i;
- a-=i;
- } else {
- ans2[++cnt2]=i;
- b-=i;
- }
- }
- cout<<cnt1<<endl;
- ; i<=cnt1; ++i) {
- )
- cout<<' ';
- cout<<ans1[i];
- }
- cout<<endl<<cnt2<<endl;
- ; i<=cnt2; ++i) {
- )
- cout<<' ';
- cout<<ans2[i];
- }
- cout<<endl;
- }
- ;
- }
C - Cram Time
Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2)的更多相关文章
- 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/ ...
- 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 ...
- 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] ...
- (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 ...
- 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 ...
- 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 ...
- 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 个数,对于一个选定的区间,区间内的数可以通过重新排列二进制数的位置得到一个新的数,问 ...
- Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3)B. Personalized Cup
题意:把一长串字符串 排成矩形形式 使得行最小 同时每行不能相差大于等于两个字符 每行也不能大于20个字符 思路: 因为使得行最小 直接行从小到大枚举即可 每行不能相差大于等于两个字符相当于 ...
- 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( ...
随机推荐
- bzoj千题计划232:bzoj4727: [POI2017]Turysta
http://www.lydsy.com/JudgeOnline/problem.php?id=4727 竞赛图tarjan缩点后得到的拓扑图一定是一条链 因为竞赛图任意两点的前后顺序确定,只有一种拓 ...
- Sublime Text 3 绿色汉化版 x64
之前做了<Sublime Text 2 绿色汉化版 x64>,这些天抽空做了下 ST3 的汉化.. 果然我没有任何理由爱上 ST3,不仅pojie麻烦,而且汉化更麻烦,菜单字符长度做了限制 ...
- 第9月第6天 push pop动画 生成器模式(BUILDER)
1. https://github.com/MichaelHuyp/QQNews 2.生成器模式(BUILDER) class MazeBuilder { public: virtual void B ...
- 底板芯片组与内存映射(Motherboard Chipsets and the Memory Map) 【转】
转自:http://blog.chinaunix.net/uid-25909619-id-4194650.html 底板芯片组与内存映射 我打算写一些关于计算机内部构造(computer intern ...
- 设置linux的console为串口【转】
转自:http://blog.chinaunix.net/uid-27717694-id-4074219.html 以Grub2为例:1. 修改文件/etc/default/grub #显示启动菜 ...
- 【mac】7z 终端命令行
链接:http://www.2cto.com/os/201410/341079.html 7z指令 7z是7zip压缩工具的常用压缩文件格式.7zip是一个开源的压缩工具,软件本身十分小巧,功能强大, ...
- 网络抓包神器-Charles使用指南
http://blog.csdn.net/liulanghk/article/details/46342205 目录 概述 安装 显示模式 PC端抓包 移动应用抓包 其他技能 charles使用问题汇 ...
- mysql添加事件
begin declare debug int; set @debug = 0; if @debug = 1 then insert into task_monitor(info) values('s ...
- javaweb笔记四
得到表单数据:1.String str = request.getParameter(String)//根据表单名得到表单值,如果是多个同名的键值,返回第一个值.2.String[] str= req ...
- /dev/null和/dev/zero的区别
/dev/null,外号叫无底洞,你可以向它输出任何数据,它通吃,并且不会撑着!/dev/zero,是一个输入设备,你可你用它来初始化文件. /dev/null------它是空设备,也称为位桶(bi ...