A1351 | [COCI-2016_2017-contest5]#1 Pareto
来源COCI
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Paret’s principle, also known as the “80/20 rule”, states that in many situations 80% of results come from 20% of (the most important) causes. For instance, Microsoft found that, by fixing 20% of most commonly reported bugs, they would eliminate 80% of downtime in their systems. In the business world, it is often said that 80% of income comes from 20% of the most important clients. In the world of mobile games, when it comes to games with free basic functionality, 50% of profit comes from
0.5% of players. Some say that 80% of your success will come from 20% of your activities.
It is a known fact that 80% of the world’s goods is owned by 20% of (the richest) people.
Your task is to check the validity of this rule based on the bank accounts owned by clients of a single bank. Is it true that 20% of accounts hold 80% of the total money? Does a stronger claim hold, for instance, that only 10% of accounts hold 85% of the total money?
More precisely: based on the given account balances of N bank clients, your task is to find numbers A and B with the maximal difference B - A such that we can say that precisely A% of accounts hold B % of the total money of all clients of the bank.
0.5% of players. Some say that 80% of your success will come from 20% of your activities.
It is a known fact that 80% of the world’s goods is owned by 20% of (the richest) people.
Your task is to check the validity of this rule based on the bank accounts owned by clients of a single bank. Is it true that 20% of accounts hold 80% of the total money? Does a stronger claim hold, for instance, that only 10% of accounts hold 85% of the total money?
More precisely: based on the given account balances of N bank clients, your task is to find numbers A and B with the maximal difference B - A such that we can say that precisely A% of accounts hold B % of the total money of all clients of the bank.
输入格式
The first line of input contains the integer N (1 ≤ N ≤ 300 000), the number of clients in the bank.
The following line contains N integers from the interval [0, 100 000 000], the balances of bank accounts in euros.
The following line contains N integers from the interval [0, 100 000 000], the balances of bank accounts in euros.
输出格式
In two lines, you must output two real numbers from the task, A and B, omitting the percentage sign. Solution with the greatest B - A difference will be unique. A deviation from the official solution for less than
0.01 will be tolerated.
0.01 will be tolerated.
输入输出样例
输入 #1
2 100 200
输出 #1
50.0 66.66666666666666
输入 #2
8 100100 10 100 1000 1 10100 90100 100100
输出 #2
37.5 96.28172769816027
Clarification of the first test case: 50% of accounts (one account, the one with 200 euros), contains
two thirds, 66.666667% of the total money.
two thirds, 66.666667% of the total money.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted