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 ...
随机推荐
- JavaScript学习笔记 -- 带参数arguments的函数的用法
JavaScript函数有带参数与不带参数两种形式,不带参数情况如下: function myFunction() { alert('HelloWorld!') } 在这种类型的函数中,输出值是确定的 ...
- Engine许可初始化 - gis开发初步
当需要对SDE中的要素类和要素数据集(矢量和栅格)进行编辑时,例如在调用IFeatureDataset的CreateFeatureClass方法时,报错提示: The application is n ...
- 10+ powerful debugging tricks with Visual Studio
10+ powerful debugging tricks with Visual Studio Original link : http://www.codeproject.com/Articles ...
- ubuntu设置关闭屏幕和锁定
见链接:http://askubuntu.com/questions/177348/how-do-i-disable-the-screensaver-lock If you want to wrap ...
- 2.servlet 生命周期
1.建Web project“2Servlet_Basic” 2.建包com.amaker.servlet 3.建类“ServletBasic.java” package com.amaker.ser ...
- yaf运行错误:Class 'Yaf_Application' not found
提示:致命错误 Yaf_Application 基类没有加载进去 一检查:phpinfo() 里yaf 扩展有没有安装上 扩展也安装进去了 这时在分布式配置文件的重写 也是正确 这时百思不得其解,没办 ...
- 删除 mysql (rpm)
http://blog.csdn.net/love__coder/article/details/6894566 a)查看系统中是否以rpm包安装的mysql [root@linux ~]# rpm ...
- CSS content内容生成技术以及应用
content属性早在CSS2.1的时候就被引入了,可以使用:before以及:after伪元素生成内容.此特性目前已被大部分的浏览器支持:(Firefox 1.5+, Safari 3.5+, IE ...
- Optimize str2date function
The job can be any string date format convert to AX date format. so that, Do not need to specify str ...
- Oracle 摘去数据块的面纱
Offset 0 1 2 3 4 5 6 7 8 9 A B C D E F 00018000h 6 A2 0 0 0c 0 80 3 8b 61 15 0 0 0 3 4 type frmt spa ...