当前位置:网站首页>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]);
}
边栏推荐
- Embedded database development programming (VI) -- C API
- FVP和Juno平台的Memory Layout介绍
- [to be continued] [depth first search] 547 Number of provinces
- [binary search] 69 Square root of X
- Research on the value of background repeat of background tiling
- win下一键生成当日的时间戳文件
- Vs2015 secret key
- Transport connection management of TCP
- Kali 2018 full image download
- Haut OJ 1350: choice sends candy
猜你喜欢
Ue4/ue5 illusory engine, material chapter, texture, compression and memory compression and memory
第六章 数据流建模—课后习题
对象的序列化
The present is a gift from heaven -- a film review of the journey of the soul
[interval problem] 435 Non overlapping interval
YOLOv5添加注意力机制
JVM call not used once in ten years
[paper notes] multi goal reinforcement learning: challenging robotics environments and request for research
TF-A中的工具介绍
YOLOv5-Shufflenetv2
随机推荐
Solon Logging 插件的添加器级别控制和日志器的级别控制
使用命令符关闭笔记本自带键盘命令
Unity card flipping effect
A preliminary study of sdei - see the essence through transactions
Haut OJ 1218: maximum continuous sub segment sum
Lua wechat avatar URL
Add level control and logger level control of Solon logging plug-in
C language Essay 1
C语言杂谈1
[转]: OSGI规范 深入浅出
Download and use of font icons
cocos2dx_ Lua card flip
Haut OJ 1245: large factorial of CDs --- high precision factorial
Data is stored in the form of table
Pause and resume of cocos2dx Lua scenario
搭建完数据库和网站后.打开app测试时候显示服务器正在维护.
Cocos2dx screen adaptation
A complete attack chain
一个新的微型ORM开源框架
FVP和Juno平台的Memory Layout介绍