ural 1864
题意描述不清 而且还卡精度 ~~
#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std; int a[110];
int main()
{
int n, sum = 0;
scanf("%d", &n);
for(int i = 0; i < n; i ++)
{
scanf("%d", &a[i]);
sum += a[i];
}
double k = (double)sum/(n+1), sum2 = 0;
for(int i = 0; i < n; i ++)
{
if((double)a[i] > k)
sum2 += (double)a[i]-k;
}
for(int i = 0; i < n; i ++)
{
if(i)
putchar(' ');
if((double)a[i] > k)
printf("%d", (int)(((double)a[i]-k)/sum2*100+0.00001));
else
printf("0");
}
return 0;
}
ural 1864的更多相关文章
- http://vjudge.net/contest/view.action?cid=51142#problem/C 精度转换的一道题。。。
C - Get-Together at Den's Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
- ural 2070. Interesting Numbers
2070. Interesting Numbers Time limit: 2.0 secondMemory limit: 64 MB Nikolay and Asya investigate int ...
- ural 2069. Hard Rock
2069. Hard Rock Time limit: 1.0 secondMemory limit: 64 MB Ilya is a frontman of the most famous rock ...
- ural 2068. Game of Nuts
2068. Game of Nuts Time limit: 1.0 secondMemory limit: 64 MB The war for Westeros is still in proces ...
- ural 2067. Friends and Berries
2067. Friends and Berries Time limit: 2.0 secondMemory limit: 64 MB There is a group of n children. ...
- ural 2066. Simple Expression
2066. Simple Expression Time limit: 1.0 secondMemory limit: 64 MB You probably know that Alex is a v ...
随机推荐
- "大哥,割草机借我用一下,我修整一下草坪。" ---- 谈谈this与JavaScript函数调用的不解之缘
在写上一篇有关apply和call的博文时(闲聊JS中的apply和call),起初我还是担心大家理解起来比较困难,因为要理解apply调用方式的前提是,至少先理解在JavaScript中函数调用是什 ...
- 使用 Time Machine 恢复 .ssh等隐藏文件夹
重装MAC系统后,要恢复.ssh等文件夹内容,而其在“Finder”中又是默认隐藏的,这时我们可以先在“Finder”中使用“前往文件夹功能…”进入指定文件夹,然后再进入“Time Machine”进 ...
- php生成txt文件换行问题
用双引号即"\r\n"换行,不能用单引号即'\r\n'.
- MongoDB Long/Int(长整型)的自增长主键 解决方案
今朝有幸尝芒果,发现自增长ID类型有多种,唯独没有Long/Int. 一思路:1. 自建一个Collection(表,假设名为:IdentityEntity,其中字段:_id, Key, Value, ...
- 【转】Python的XML-RPC简介
编写客户端提交数据到服务器处理是程序员最常碰到的几个问题之一.各种不同的语言对此都有相应的解决方案.比如Unix下,C程序员们可以用SUNRPC,Java程序员则使用RMI来处理.大多数语言还都可以使 ...
- 使用RX方式模拟DoubanFm的登陆
WP7下的Get Post都是异步的 关于RX http://www.cnblogs.com/yangecnu/archive/2012/11/03/Introducting_ReactiveExte ...
- CentOS 6.3 配置 yum
ContOS 配置yum:1.cd /etc/yum.repos.d2.创建个任意目录,将所有文件移动到创建的目录中,除了CentOS-Media.repo3.编辑CentOS-Media.repov ...
- mapreduce 实现pagerank
输入格式: A 1 B,C,D B 1 C,Dmap: B A 1/3 C A 1/3 D A 1/3 A |B,C,D C B 1/2 D B 1/2 B |C,Dreduce: B (1-0.85 ...
- Shell 总结
find: –name 'filenme' * ? [] ; –iname; –regex PATTERN; –user username; –group; –uid; –gid; –nouser; ...
- HTTP报文格式
请求报文 <method><SP><uri><SP><version><CRLF> <head-name><: ...