当前位置:网站首页>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]);
}
边栏推荐
- cocos_ Lua loads the file generated by bmfont fnt
- [allocation problem] 455 Distribute cookies
- A preliminary study of sdei - see the essence through transactions
- Optimization scheme of win10 virtual machine cluster
- Binary search basis
- TF-A中的工具介绍
- PMP考生,请查收7月PMP考试注意事项
- 2022/7/2 question summary
- Page countdown
- The present is a gift from heaven -- a film review of the journey of the soul
猜你喜欢
[to be continued] [UE4 notes] L2 interface introduction
win10虚拟机集群优化方案
Data is stored in the form of table
[to be continued] [depth first search] 547 Number of provinces
Page countdown
Applet live + e-commerce, if you want to be a new retail e-commerce, use it!
The present is a gift from heaven -- a film review of the journey of the soul
YOLOv5-Shufflenetv2
Use of snippets in vscode (code template)
Django reports an error when connecting to the database. What is the reason
随机推荐
Binary search basis
支持多模多态 GBase 8c数据库持续创新重磅升级
lxml.etree.XMLSyntaxError: Opening and ending tag mismatch: meta line 6 and head, line 8, column 8
Insert sort
Improvement of pointnet++
64 horses, 8 tracks, how many times does it take to find the fastest 4 horses at least
[to be continued] [UE4 notes] L2 interface introduction
对象的序列化
Page countdown
嵌入式数据库开发编程(五)——DQL
[to be continued] [UE4 notes] L1 create and configure items
YOLOv5添加注意力机制
TF-A中的工具介绍
Introduction to tools in TF-A
Haut OJ 1218: maximum continuous sub segment sum
UE fantasy engine, project structure
【ES实战】ES上的native realm安全方式使用
Haut OJ 1245: large factorial of CDs --- high precision factorial
What is the agile proportion of PMP Exam? Dispel doubts
[轉]: OSGI規範 深入淺出