Codeforces 758A:Holiday Of Equality(水题)
http://codeforces.com/problemset/problem/758/A
题意:给出n个值,求这里面每个值都要变成最大的那个数,总共需要加上多少。
思路:找出最大的直接算。
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <stack>
using namespace std;
#define INF 0x3f3f3f3f
#define N 100010
typedef long long LL;
int num[N]; int main() {
int n;
cin >> n;
int ma = ;
for(int i = ; i <= n; i++) {
cin >> num[i];
if(num[i] > ma) ma = num[i];
}
int tol = ;
for(int i = ; i <= n; i++) {
tol += ma - num[i];
}
cout << tol << endl;
return ;
}
Codeforces 758A:Holiday Of Equality(水题)的更多相关文章
- Codeforces 758A Holiday Of Equality
题目链接:http://codeforces.com/problemset/problem/758/A A. Holiday Of Equality time limit per test 1 sec ...
- Codeforces 758A. Holiday Of Equality 贪心
题目大意: 给定一个长为\(n\)序列,每次操作在一个数上+1,求最小的操作次数使所有的数大小相同. 题解: 对这种题无话可说 #include <cstdio> #include < ...
- codeforces 577B B. Modulo Sum(水题)
题目链接: B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #367 (Div. 2)---水题 | dp | 01字典树
A.Beru-taxi 水题:有一个人站在(sx,sy)的位置,有n辆出租车,正向这个人匀速赶来,每个出租车的位置是(xi, yi) 速度是 Vi;求人最少需要等的时间: 单间循环即可: #inclu ...
- codeforces 696A Lorenzo Von Matterhorn 水题
这题一眼看就是水题,map随便计 然后我之所以发这个题解,是因为我用了log2()这个函数判断在哪一层 我只能说我真是太傻逼了,这个函数以前听人说有精度问题,还慢,为了图快用的,没想到被坑惨了,以后尽 ...
- CodeForces 589I Lottery (暴力,水题)
题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...
- Codeforces Gym 100286G Giant Screen 水题
Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...
- codeforces 710A A. King Moves(水题)
题目链接: A. King Moves 题意: 给出king的位置,问有几个可移动的位置; 思路: 水题,没有思路; AC代码: #include <iostream> #include ...
- codeforces 659A A. Round House(水题)
题目链接: A. Round House time limit per test 1 second memory limit per test 256 megabytes input standard ...
- CodeForces 489B BerSU Ball (水题 双指针)
B. BerSU Ball time limit per test 1 second memory limit per test 256 megabytes input standard input ...
随机推荐
- WPF 自定义范围分组
<Window x:Class="ViewExam.MainWindow" xmlns="http://schemas.microsoft.com/w ...
- MEF 插件式开发 - 小试牛刀
原文:MEF 插件式开发 - 小试牛刀 目录 MEF 简介 实践出真知 面向接口编程 控制反转(IOC) 构建入门级 MEF 相关参考 MEF 简介 Managed Extensibility Fra ...
- MVC linq执行顺序
- JS 三个对话框
<!DOCTYPE html><html lang="en" xmlns="http://www.w3.org/1999/xhtml"> ...
- PHP提取字符串中的图片地址
PHP提取字符串中的图片地址 $str='<p><img border="0" src="upfiles/2009/07/1246430143_1.jp ...
- adb help
Android Debug Bridge version 1.0.32Revision cc6ae925e394-android -a - directs adb to listen on all i ...
- “重定向次数过多”或者“Too many automatic redirections were attempted”的错误:
C# 代码 C# code? 1 2 3 4 5 6 7 8 9 String url="http://www.google.com.hk/search?hl=zh-CN&q=孟宪会 ...
- SQLSERVER 数据库备份脚本-支持多库备份
原文:SQLSERVER 数据库备份脚本-支持多库备份 <pre name="code" class="sql">--变量定义 DECLARE @b ...
- /etc/passwd和/etc/group文件详解
用户管理 想要知道, 系统中有哪些用户, 可以查看这个文件: /etc/passwd root:x:::root:/root:/bin/bash bin:x:::bin:/bin:/sbin/nolo ...
- 【必须知道】Enum_Flags
[Flags] enum AnyThings{ A=1, B=2, C=4, D=8 } 枚举赋值必须是2^n才可以,目的是实现他们的二进制表示中的 1 ,不要重叠,如 1=0001 2=0010 ...