Codeforces 1154 - A/B/C/D/E/F/G - (Undone)
链接:https://codeforces.com/contest/1154
A - Restoring Three Numbers - [水]
#include<bits/stdc++.h>
using namespace std; int a[];
int main()
{
cin>>a[]>>a[]>>a[]>>a[];
sort(a,a+);
for(int i=;i<=;i++) printf("%d ",a[]-a[i]);
}
B - Make Them Equal - [分类讨论]
#include<bits/stdc++.h>
using namespace std;
const int maxn=;
int n;
int a[maxn];
bool vis[maxn]; bool check(int x,int p)
{
for(int i=;i<=n;i++)
{
if(a[i]+x==p || a[i]==p || a[i]-x==p) continue;
return ;
}
return ;
}
int main()
{
cin>>n; int cnt=;
for(int i=;i<=n;i++)
{
cin>>a[i];
if(!vis[a[i]]) vis[a[i]]=, cnt++;
} if(cnt==){printf("0\n"); return ;} if(cnt==)
{
int min1=, min2=;
for(int x=;x<=;x++)
{
if(vis[x])
{
if(min1==) min1=x;
else if(min2==) min2=x;
else break;
}
}
int D;
if((min2-min1)%==) D=(min2-min1)/;
else D=min2-min1;
cout<<D<<endl;
return ;
} int min1=, min2=, min3=;
for(int x=;x<=;x++)
{
if(vis[x])
{
if(min1==) min1=x;
else if(min2==) min2=x;
else if(min3==) min3=x;
else break;
}
}
if(min3-min2==min2-min1)
{
int D=min3-min2;
if(check(D,min2)) cout<<D<<endl;
else cout<<-<<endl;
}
else cout<<-<<endl;
}
C - Gourmet Cat
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; ll a,b,c;
ll run(int st)
{
ll A=a, B=b, C=c;
for(int i=st;i<=;i++)
{
if(i== || i== || i==)
{
if(A>) A--;
else return i-st;
}
else if(i== || i==)
{
if(B>) B--;
else return i-st;
}
else if(i== || i==)
{
if(C>) C--;
else return i-st;
}
}
ll ans=-st+;
ll num=min(min(A/,B/),C/);
ans+=num*;
A-=*num, B-=*num, C-=*num;
for(int i=;;i++)
{
if(i== || i== || i==)
{
if(A>) A--;
else return ans+i-;
}
else if(i== || i==)
{
if(B>) B--;
else return ans+i-;
}
else if(i== || i==)
{
if(C>) C--;
else return ans+i-;
}
}
}
int main()
{
cin>>a>>b>>c;
ll ans=;
for(int st=;st<=;st++)
{
ll res=run(st);
//printf("%d: %I64d\n",st,res);
ans=max(ans,res);
}
cout<<ans<<endl;
}
D - Walking Robot - [贪心]
E - Two Teams - [线段树+链表]
F - Shovels Shop - [DP]
G - Minimum Possible LCM - (Undone)
Codeforces 1154 - A/B/C/D/E/F/G - (Undone)的更多相关文章
- Codeforces 659 - A/B/C/D/E/F/G - (Undone)
链接:https://codeforces.com/contest/659 A - Round House - [取模] AC代码: #include<bits/stdc++.h> usi ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...
- Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块
Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块 [Problem Description] ...
- Codeforces Bubble Cup 8 - Finals [Online Mirror] F. Bulbo DP
F. Bulbo Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/575/problem/F Des ...
- Educational Codeforces Round 58 (Rated for Div. 2) F dp + 优化(新坑) + 离线处理
https://codeforces.com/contest/1101/problem/F 题意 有n个城市,m辆卡车,每辆卡车有起点\(s_i\),终点\(f_i\),每公里油耗\(c_i\),可加 ...
- Codeforces 670 - A/B/C/D/E/F - (Done)
链接:https://codeforces.com/contest/670 A - Holidays - [水] AC代码: #include<bits/stdc++.h> using n ...
- Codeforces 1132 - A/B/C/D/E/F - (Undone)
链接:http://codeforces.com/contest/1132 A - Regular Bracket Sequence - [水] 题解:首先 "()" 这个的数量多 ...
- Codeforces 1114 - A/B/C/D/E/F - (Undone)
链接:http://codeforces.com/contest/1114 A - Got Any Grapes? 题意:甲乙丙三个人吃葡萄,总共有三种葡萄:绿葡萄.紫葡萄和黑葡萄,甲乙丙三个人至少要 ...
- Codeforces 1099 - A/B/C/D/E/F - (Done)
链接:https://codeforces.com/contest/1099 A - Snowball - [模拟水题] 题意:有一个雪球从山顶滚落,山坡上有两块石头,每秒钟会一次发生三件事:1.雪球 ...
随机推荐
- day 14 - 1 生成器
生成器 生成器 生成器的本质就是迭代器生成器的表现形式 生成器函数 生成器函数 —— 本质上就是我们自己写得函数 生成器表达式生成器函数: 含有 yield 关键字的函数就是生成器函数 特点: 调用函 ...
- Servlet中文件上传下载
1.文件下载: package FileUploadAndDown; import java.io.FileInputStream; import java.io.IOException; impor ...
- Why Random Initialization in Neural Network?
- 使用ob缓存实现真静态
实现页面的真静态化可以通过php的ob缓存来实现: 1.ob缓存认识 Ob就是output_buffering:输出缓存. 如果ob(函数ob_start())缓存打开,则echo的数据首先放在ob缓 ...
- 通过go-ethereum源码看如何管理项目
今天抽空看了下go-ethereum项目的源码 ( https://github.com/ethereum/go-ethereum ),其中 ethereum 是github下的一个帐号.go-eth ...
- 逆元知识普及(进阶篇) ——from Judge
关于一些逆元知识的拓展 刚艹完一道 提高- 的黄题(曹冲养猪) ,于是又来混一波讲解了 ——承接上文扫盲篇 四.Lucas定理(求大组合数取模) 题外话 这里Lucas定理的证明需要用到很多关 ...
- 洛谷P5280 [ZJOI2019]线段树 [线段树,DP]
传送门 无限Orz \(\color{black}S\color{red}{ooke}\)-- 思路 显然我们不能按照题意来每次复制一遍,而多半是在一棵线段树上瞎搞. 然后我们可以从\(modify\ ...
- vue脚手架安装步骤vue-cli
1.环境搭建 安装node.js: 从node.js官网下载并安装node,安装过程很简单. npm 版本需要大于 3.0,如果低于此版本需要升级它: # 查看版本 $ npm -v 2.3 ...
- Active information gathering-services enumeration
1.Summaize the book Practical Web Penetration Testing first nmap tools is important for gather in ...
- CentOS7.6编译安装nginx
配置阿里云yum源 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak wget -O /etc/yu ...