当前位置:网站首页>Haut OJ 1401: praise energy
Haut OJ 1401: praise energy
2022-07-05 05:20:00 【hunziHang】
Problem description :
Tao Bao Liang 11 give the thumbs-up PK Energy gathering was very hot at that time . Just a few days. , Someone knows the secret of win-win cooperation , There are also people who fight in order to cheat praise , A lot of time was wasted for a little money . But anyway , Finally, it's time to divide up the energy of the team . The energy shared by each person is the number of likes that person has contributed to the team ( Proportion of the whole team ) In direct proportion to , The more you contribute , The more energy you get . Suppose a team has 5 personal .
Input :
The first line is the total energy integer of the team n(100<=n<=100000)
The first 2~6 Line is everyone The number of likes contributed to the team x. (0<= x <= 100000)
Output :
Output takes up one line , Output the energy shared by everyone separately ( Rounding down ), Space separates the middle
The sample input :
8000 50 30 10 10 0
Sample output :
4000 2400 800 800 0
Tips :
If two people contribute equal praise , Then they share the same energy value .
Cause analysis :
1. Be careful All contributions 0 The situation of Then divide equally .
2. Contribution points given in the example , Not by pressing 100% Calculated , Just contribute , Just give exactly equal to 100.
Solution :
#include<stdio.h>
#include<math.h>
int main()
{
int n,a[6],s=0,b[6];
int i;
scanf("%d",&n);
for(i=1;i<=5;i++)
{
scanf("%d",&a[i]);
s+=a[i];
}
if(s==0)
for(i=1;i<=5;i++)
b[i]=n/5;
else
for(i=1;i<=5;i++)
b[i]=n*(a[i]*1.0/s);
for(i=1;i<=5;i++)
printf("%d ",b[i]);
}
边栏推荐
- 《动手学深度学习》学习笔记
- [to be continued] [depth first search] 547 Number of provinces
- Simple modal box
- 使用命令符关闭笔记本自带键盘命令
- Simple HelloWorld color change
- On-off and on-off of quality system construction
- C language Essay 1
- Time format conversion
- Applet Live + e - commerce, si vous voulez être un nouveau e - commerce de détail, utilisez - le!
- 小程序直播+電商,想做新零售電商就用它吧!
猜你喜欢

win10虚拟机集群优化方案
![[merge array] 88 merge two ordered arrays](/img/e9/a73d9f22eead8e68c1e45c27ff6e6c.jpg)
[merge array] 88 merge two ordered arrays

第六章 数据流建模—课后习题

On-off and on-off of quality system construction

Research on the value of background repeat of background tiling

【论文笔记】Multi-Goal Reinforcement Learning: Challenging Robotics Environments and Request for Research

UE fantasy engine, project structure

Use of snippets in vscode (code template)

Service fusing hystrix

嵌入式数据库开发编程(零)
随机推荐
Unity ugui source code graphic
Listview pull-down loading function
嵌入式数据库开发编程(六)——C API
Service fusing hystrix
Solon 框架如何方便获取每个请求的响应时间?
Generate filled text and pictures
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
YOLOv5-Shufflenetv2
cocos_ Lua listview loads too much data
利用HashMap实现简单缓存
2022年上半年国家教师资格证考试
Download xftp7 and xshell7 (official website)
Page countdown
【ES实战】ES上的native realm安全方式使用
A preliminary study of sdei - see the essence through transactions
2022/7/2 question summary
Unity find the coordinates of a point on the circle
Es module and commonjs learning notes -- ESM and CJS used in nodejs
Solon Logging 插件的添加器级别控制和日志器的级别控制
Cocos2dx Lua registers the touch event and detects whether the click coordinates are within the specified area