链接: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. django登录

    一. form表单使用注意事项: 1. action="" 提交地址, method='post' 请求方式 2. input 标签要有name属性才能被获取 3. 有一个inpu ...

  2. Django之Cookie和Session

    http://www.cnblogs.com/liwenzhou/p/8343243.html 一.Cookie Cookie是什么? 就是保存在客户端浏览器上的键值对. Cookie为什么存在? 因 ...

  3. Visual Studio Code(VSCODE)语言设置

    Visual Studio Code(VSCODE)语言设置 语言设置 1.快捷键 Windows.Linux 快捷键是:ctrl+shift+p macOS 快捷键是:command + shift ...

  4. 【原创】大叔经验分享(43)logstash设置jdbc_default_timezone后报错

    logstash6.6.0-6.6.2版本使用jdbc input plugin时如果设置了jdbc_default_timezone,会报错: { 2012 rufus-scheduler inte ...

  5. docker简单介绍---网络端口管理

    一.查看docker支持的网络类型 docker network ls bridge:容器使用虚拟交换机的进行通信 host:使用宿主机的网络 none:只给容器分配一个lo的网卡,无法和外界进行通信 ...

  6. jQuery选择器 :eq() 不能识别变量参数的问题解决方案

    问题: js语法中,引号内变量会直接解释为字符串,因此使用:eq()时参数将被识别为字符串而不是变量指代的内容 如下错误写法: $(".circle span:eq(count-1)&quo ...

  7. pl/sql学习(6): 引号/程序调试/列中的字符串合并/正则表达式

    有关自治事务的问题: https://www.cnblogs.com/princessd8251/p/4132649.html 我在plsql development学习中遇到的常见问题: (一) 引 ...

  8. .net OADate 转javascript的Datetime js 5位 日期 转换

    以下是将.net的OADate转成javascript的DateTime函数. 其中参数oadate是.net那里传过来的UTC时间的double.记得 一定是UTC时间. .net Double o ...

  9. 在.NET开发中的单元测试工具之(2)——xUnit.Net

    在上一篇<在.NET开发中的单元测试工具之(1)——NUnit>中讲述了如何使用NUnit在.NET开发中进行单元测试以及NUnit的一些缺点,今天将讲述如何使用xUnit.Net来进行单 ...

  10. Noj - 在线强化训练3

    状态 题号 竞赛题号 标题   1091 A 求解逆波兰表达式(Calculate the reverse Polish notation)   1017 B 数列   1323 C 穷举n位二进制数 ...