链接: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)的更多相关文章

  1. Codeforces 659 - A/B/C/D/E/F/G - (Undone)

    链接:https://codeforces.com/contest/659 A - Round House - [取模] AC代码: #include<bits/stdc++.h> usi ...

  2. 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 ...

  3. Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块

    Educational Codeforces Round 71 (Rated for Div. 2)-F. Remainder Problem-技巧分块 [Problem Description] ​ ...

  4. 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 ...

  5. 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\),可加 ...

  6. Codeforces 670 - A/B/C/D/E/F - (Done)

    链接:https://codeforces.com/contest/670 A - Holidays - [水] AC代码: #include<bits/stdc++.h> using n ...

  7. Codeforces 1132 - A/B/C/D/E/F - (Undone)

    链接:http://codeforces.com/contest/1132 A - Regular Bracket Sequence - [水] 题解:首先 "()" 这个的数量多 ...

  8. Codeforces 1114 - A/B/C/D/E/F - (Undone)

    链接:http://codeforces.com/contest/1114 A - Got Any Grapes? 题意:甲乙丙三个人吃葡萄,总共有三种葡萄:绿葡萄.紫葡萄和黑葡萄,甲乙丙三个人至少要 ...

  9. Codeforces 1099 - A/B/C/D/E/F - (Done)

    链接:https://codeforces.com/contest/1099 A - Snowball - [模拟水题] 题意:有一个雪球从山顶滚落,山坡上有两块石头,每秒钟会一次发生三件事:1.雪球 ...

随机推荐

  1. JQuery EasyUI 表单

    EasyUI 创建异步提交表单 ♦ 通过使用 easyui 表单插件来改变表单为 ajax表单. 表单提交所有字段到后台服务器,服务器处理和发送一些数据返回到前端页面.我们接收返回数据,并将它显示出来 ...

  2. 关于含RecyclerView的fragment来回切换时页面自动滑动到底部的解决方法

    原因: 在fragment中来回切换时RecyclerView获得了焦点,而RecyclerView的 focusableOnTouchMode属性默认是true,所以在切换时RecyclerView ...

  3. 【原创】运维基础之Docker(4)实用工具ctop

    ctop类似于top,top监控的是进程,ctop监控的是容器(container top) 安装 # wget https://github.com/bcicen/ctop/releases/dow ...

  4. sqlite 中的分页语句

    2个关键字 select * from testtable limit 2 offset 1;

  5. java学习 之 操作符

    操作符介绍 java语言操作符 1.赋值操作符  = 2.计算操作符   + .- (减.负号).*(乘)./(除) 3.递增递减     --(递减).++(递增) 4.关系操作符    ==.!= ...

  6. Vue CLI 3+tinymce 5富文本编辑器整合

    基于Vue CLI 3脚手架搭建的项目整合tinymce 5富文本编辑器,vue cli 2版本及tinymce 4版本参考:https://blog.csdn.net/liub37/article/ ...

  7. (初)Knockout 监控属性(Observables)

    1 创建带有监控属性的view model 1.1 Observables Knockout是在下面三个核心功能是建立起来的: 监控属性(Observables)和依赖跟踪(Dependency tr ...

  8. [原创]SVN使用

    在企业中,SVN环境,由企业已经搭建好,并提供相关技术支持.对于个人,如果想在个人PC上实现版本管理,亦可以实现.安装Visual SVN及其相关工具 如何使用,可见下链接 http://www.cn ...

  9. A tuple is defined as a function

    In James Munkres "Topology", the concept for a tuple, which can be \(m\)-tuple, \(\omega\) ...

  10. entityframework单例模式泛型用法

    public class yms_Entity<T> where T :DbContext { private static T _instance; public static read ...