链接: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. gitlab服务器搭建

    当然喜欢英文的可以参考官方文档:https://about.gitlab.com/downloads/ 1.  根据自己的操作系统选择相应的安装方法,我这边是阿里云 centos 7的 sudo yu ...

  2. C# 对MongoDB 进行增删改查的简单操作

    C# 对MongoDB 进行增删改查的简单操作   下面演示下C#操作MongoDB驱动的简单的增删改查代码 运用到的MongoDB支持的C#驱动,当前版本为1.6.0 1,连接数据库   /// & ...

  3. JDBC连接MariaDB:数据传输加密

    环境:win7+springboot+mybatis+mariadb 需求说明: 未做安全加固前用wireshark抓包: 可以很明显看到用户名.数据库和 SQL,这种情况是有安全风险的. 1.下载o ...

  4. 【python】实用的logging封装

    #!/usr/bin/python import logging import logging.handlers def set_logger(filename, logmod): log_size ...

  5. eclipse 报错问题:java.lang.ClassNotFoundException:

    解决方法:https://www.cnblogs.com/whatlonelytear/articles/5921978.html

  6. java----dom4j 解析XML

    dom4j: 由于内部采用迭代器,适合读取大文档: 数据块 1.下载 https://dom4j.github.io/ 2.添加包到工程目录下 使用 import org.dom4j.Document ...

  7. Swift 统计项目中所有按钮的点击次数

    class Swizzle: NSObject { override class func load() { UIButton.xxx_swizzleSendAction() } } extensio ...

  8. James Munkres Topology: Theorem 16.3

    Theorem 16.3 If \(A\) is a subspace of \(X\) and \(B\) is a subspace of \(Y\), then the product topo ...

  9. Android+openCV 动态人脸检测

    动态人脸检测前提是需要打开摄像头. 网上看了很多教程,我知道的有两种方式打开摄像头: JavaCameraView mCameraView = new JavaCameraView(this, -1) ...

  10. Python与R的区别和联系

    转自:http://bbs.pinggu.org/thread-3078817-1-1.html 有人说Python和R的区别是显而易见的,因为R是针对统计的,python是给程序员设计的,其实这话对 ...