当前位置:网站首页>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]);
}
边栏推荐
- Unity enables mobile phone vibration
- FVP和Juno平台的Memory Layout介绍
- Ue4/ue5 illusory engine, material part (III), material optimization at different distances
- Cocos progress bar progresstimer
- 《动手学深度学习》学习笔记
- 远程升级怕截胡?详解FOTA安全升级
- 64 horses, 8 tracks, how many times does it take to find the fastest 4 horses at least
- [to be continued] [UE4 notes] L3 import resources and project migration
- PMP考生,请查收7月PMP考试注意事项
- 十年不用一次的JVM调用
猜你喜欢
随机推荐
Introduction to memory layout of FVP and Juno platforms
Unity enables mobile phone vibration
How can the Solon framework easily obtain the response time of each request?
嵌入式数据库开发编程(零)
Shell Sort
Lua determines whether the current time is the time of the day
Reverse one-way linked list of interview questions
【ES实战】ES上的native realm安全方式使用
Solon Logging 插件的添加器级别控制和日志器的级别控制
win10虚拟机集群优化方案
The next key of win generates the timestamp file of the current day
Haut OJ 1243: simple mathematical problems
发现一个很好的 Solon 框架试手的教学视频(Solon,轻量级应用开发框架)
2022/7/1 learning summary
cocos_ Lua listview loads too much data
64 horses, 8 tracks, how many times does it take to find the fastest 4 horses at least
[转]MySQL操作实战(一):关键字 & 函数
Programmers' experience of delivering takeout
Simple HelloWorld color change
搭建完数据库和网站后.打开app测试时候显示服务器正在维护.