当前位置:网站首页>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]);
}
边栏推荐
- National teacher qualification examination in the first half of 2022
- Collapse of adjacent vertical outer margins
- 支持多模多态 GBase 8c数据库持续创新重磅升级
- Download and use of font icons
- Simple HelloWorld color change
- Fragment addition failed error lookup
- [to be continued] I believe that everyone has the right to choose their own way of life - written in front of the art column
- Haut OJ 1321: mode problem of choice sister
- Insert sort
- Download xftp7 and xshell7 (official website)
猜你喜欢
随机推荐
Ue4/ue5 illusory engine, material part (III), material optimization at different distances
Under the national teacher qualification certificate in the first half of 2022
Merge sort
Reverse one-way linked list of interview questions
sync.Mutex源码解读
[转]MySQL操作实战(一):关键字 & 函数
嵌入式数据库开发编程(五)——DQL
[to be continued] [UE4 notes] L1 create and configure items
A complete attack chain
Haut OJ 1241: League activities of class XXX
room数据库的使用
[to be continued] [UE4 notes] L3 import resources and project migration
Research on the value of background repeat of background tiling
C language Essay 1
2022/7/2 question summary
Demonstration of using Solon auth authentication framework (simpler authentication framework)
Solon 框架如何方便获取每个请求的响应时间?
Unity card flipping effect
Transport connection management of TCP
The present is a gift from heaven -- a film review of the journey of the soul









