Codeforces 892A Greed
来源:互联网 发布:淘宝上卖的冷光美白仪 编辑:程序博客网 时间:2024/06/06 01:16
#define _CRT_SECURE_NO_WARNINGS#include <cstdio>#include <iostream>using namespace std;int main() {int n;scanf("%d", &n);long long tot = 0;for (int i = 1;i <= n;++i) {int v;scanf("%d", &v);tot += v;}int mmax=-1;int max=-1;for (int i = 1;i <= n;++i) {int v;scanf("%d", &v);if(v>mmax){max = mmax;mmax = v;}else if (v >= max) {max = v;}}if (tot > (mmax + max)) {printf("NO\n");}elseprintf("YES\n");//system("pause");return 0;}
求一个sum并与最大的两个容量之和作比较即可。
数据范围爆int,改用ll。
阅读全文
0 0
- Codeforces 892A. Greed
- Codeforces 892A Greed
- codeforces 892A. Greed
- Codeforces 892 A Greed(水题)
- Codeforces Round #446 (Div. 2) A Greed
- Codeforces Round #446 (Div. 2) A. Greed
- A. Greed
- A. Greed(水题)
- Algorithm:Greed Algorithm
- CodeForces-a
- Codeforces 903A A
- ZOJ 3607Lazier Salesgirl(greed)
- CodeForces 18A A - Triangle
- CodeForces 133A A. HQ9+
- codeforces 651A A. Joysticks
- 【Codeforces 597A】A. Divisibility
- 【 Codeforces 615A】A. Bulbs
- A. Divisibility CodeForces 597A
- 13 OF 100DAYS
- java中冒泡排序和选择排序
- 使用securecrt访问linux虚拟机实现互通访问
- 【ARM-DS-5】成功破解ARM DS-5 v5.26.0 + 配置高通MDM9026芯片的demo==》成功编译得到demo.bin文件
- 13 STL中数组容器array(学自Boolean)
- Codeforces 892A Greed
- 使用Tensorflow实现CNN进行MNIST数字识别
- ubuntu 15.04 安装Caffe
- 十二:数据运算
- 174. Dungeon Game(H)
- JVM加载class文件的原理机制
- 程序员必备的代码审查(Code Review)清单
- 大菲波数-HDU 1715-大数问题
- c sizeof