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( ...
随机推荐
- 2018年9月28日CCPC秦皇岛站参赛总结
day1: 被中间结果超出int范围给叉了,立刻意识到了自己的弱小以及校赛出题的时候是怎么叉别人的 day2: 签到签了40分钟,谨慎一些还是很好的,机子重启耽误了一些时间 一道暴力+LCS的简单题被 ...
- Spring Mvc + Maven + yuicompressor 使用 profile 来压缩 javascript ,css 文件; (十)
profile相关知识点: 在开发项目时,设想有以下场景: 你的Maven项目存放在一个远程代码库中(比如github),该项目需要访问数据库,你有两台电脑,一台是Linux,一台是Mac OS X, ...
- 20155318 2016-2017-2 《Java程序设计》第六周学习总结
20155318 2016-2017-2 <Java程序设计>第六周学习总结 教材学习内容总结 学习目标 理解流与IO 理解InputStream/OutPutStream的继承架构 理解 ...
- 第10月第21天 手势识别 开屏广告 Xcode快捷键
1.手势识别 http://yulingtianxia.com/blog/2016/12/29/Multimedia-Edit-Module-Architecture-Design/ 2.开屏广告 h ...
- shell邮件发送功能实现
本文中以163邮箱为例,测试shell邮件发送功能.常见的工具有:mailx.sendmail.mutt等. 1.设置邮件客户端 (1)启用pop3.smtp服务,以支持第三方客户端支持 (2)设置授 ...
- 日期控件-my97DatePicker用法
网上资料,用法,只能选最近30天等等:http://jingyan.baidu.com/article/e6c8503c7244bae54f1a18c7.html
- python之pip安装mysql-python失败
前言 由于公司使用的python版本是python2,并且连接mysql的包是mysql-python,但是mysql-python 使用pip安装报错,需要C++环境等依赖,于是使用wheel直接安 ...
- C语言内存分布
C语言内存分布 典型的C语言程序内存表示分区共有5个部分: 正文段 Text segment 已初始化数据段(数据段)Initialized data segment 未初始化数据段(bss)Unin ...
- Qt 数字和字符处理总结
1. 四舍五入保留小数几位 QString str="12.3456789"; double d1=str.toDouble(); qDebug()<<"d1 ...
- 网络抓包神器-Charles使用指南
http://blog.csdn.net/liulanghk/article/details/46342205 目录 概述 安装 显示模式 PC端抓包 移动应用抓包 其他技能 charles使用问题汇 ...