链接: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. Linux下使用crontab对MYSQL进行备份以及定时清

      数据备份是一个项目必需的工作,保证数据库出问题时,将损失减小到最低.本文记录下linux服务器中使用脚本对MYSQL数据备份,并且定时清除7天前的备份. crontab定时备份 1.创建备份目录 ...

  2. webstorm javascript 分号提示如何自动补全或去掉?

    转载于: https://segmentfault.com/q/1010000006930809?_ea=1180552 如图片显示,每行末尾都会提示你加上分号,如何让IDE自动完成这个操作或者取消这 ...

  3. 在Linux中调试段错误(core dumped)

    在Linux中调试段错误(core dumped) 在作比赛的时候经常遇到段错误, 但是一般都采用的是printf打印信息这种笨方法,而且定位bug比较慢,今天尝试利用gdb工具调试段错误. 段错误( ...

  4. Gulp实战

    推荐文章: gulp.js中文网   :     http://www.gulpjs.com.cn/ DBPOO           :   http://www.dbpoo.com/getting- ...

  5. 【原创】运维基础之Docker(1)简介、安装、使用

    docker 18.09 官方:https://docs.docker.com/ 一 简介 Docker is a platform for developers and sysadmins to d ...

  6. iOS 中的屏幕旋转shouldAutorotate和supportedInterfaceOrientations的先后关系

    这2个UIViewController的属性,都和旋转相关, 当设备发生旋转时,首先会查看根controller的shouldAutorotate是否允许旋转,如果允许,再通过 supportedIn ...

  7. linux下Flask框架搭建简单网页

    开始安装FLASK需要创建一个虚拟环境,虚拟环境可以不干扰正在使用的系统环境,避免影响,并且也不需要完全的root权限,更加安全可靠. 搭建环境 Python3.4 进入到microblog目录下创建 ...

  8. UOJ#36. 【清华集训2014】玛里苟斯 线性基

    原文链接https://www.cnblogs.com/zhouzhendong/p/UOJ36.html 题解 按照 $k$ 分类讨论: k=1 : 我们考虑每一位的贡献.若有至少一个数第 $i$ ...

  9. Codeforces 1110D. Jongmah 动态规划

    原文链接https://www.cnblogs.com/zhouzhendong/p/CF1110D.html 题意 给定 n 个数,每一个数都是在 [1,m] 里的整数. 从中取出形如 {x,x,x ...

  10. Scala的泛型

    类比java中的泛型: 上界(协变).下界(逆变) scala中泛型采用中括号声明 val array = Array[Int](,,,) array() //声明什么类型就返回什么类型 //test ...