当前位置:网站首页>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
- 使用Room数据库报警告: Schema export directory is not provided to the annotation processor so we cannot expor
- Transport connection management of TCP
- Web APIs DOM节点
- To the distance we have been looking for -- film review of "flying house journey"
- Fragment addition failed error lookup
- Haut OJ 1357: lunch question (I) -- high precision multiplication
- Haut OJ 1347: addition of choice -- high progress addition
- [sum of two numbers] 169 sum of two numbers II - enter an ordered array
- Solon Auth 认证框架使用演示(更简单的认证框架)
猜你喜欢

嵌入式数据库开发编程(五)——DQL

Grail layout and double wing layout

Research on the value of background repeat of background tiling

Generate filled text and pictures

win10虚拟机集群优化方案

YOLOv5-Shufflenetv2

利用HashMap实现简单缓存
![[turn to] MySQL operation practice (III): table connection](/img/70/20bf9b379ce58761bae9955982a158.png)
[turn to] MySQL operation practice (III): table connection

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

On-off and on-off of quality system construction
随机推荐
Yolov5 ajouter un mécanisme d'attention
Django reports an error when connecting to the database. What is the reason
[merge array] 88 merge two ordered arrays
[转]: OSGI规范 深入浅出
Embedded database development programming (V) -- DQL
TF-A中的工具介绍
Count sort
win下一键生成当日的时间戳文件
cocos2dx_ Lua card flip
Merge sort
被舆论盯上的蔚来,何时再次“起高楼”?
Time format conversion
2022上半年全国教师资格证下
[speed pointer] 142 circular linked list II
记录QT内存泄漏的一种问题和解决方案
Kali 2018 full image download
A three-dimensional button
使用Room数据库报警告: Schema export directory is not provided to the annotation processor so we cannot expor
Haut OJ 1316: sister choice buys candy III
A complete attack chain