Load Balancing

查看题解 查看答案
题目描述
Time Limit: 1000 ms
Memory Limit: 256 mb

请先登录再刷题,不会做的题目右上可以查看题解和答案~

输入输出格式
输入描述:
Each input file contains one test case, which gives a positive integer S (2≤N≤200), the size of the incoming traffic load.
输出描述:
For each case, print two numbers in a line, namely, M, the maximum number of backend servers required, and D, the minimum of the difference between the largest and the smallest sizes in a partition with M servers. The numbers in a line must be separated by one space, and there must be no extra space at the beginning or the end of the line.
输入输出样例
输入样例#:
22
输出样例#:
复制
4 1
提示
There are more than one way to partition the load. For example:
22
= 8 + 14
= 8 + 7 + 7
= 4 + 4 + 7 + 7
or
22
= 10 + 12
= 10 + 6 + 6
= 4 + 6 + 6 + 6
or
22
= 10 + 12
= 10 + 6 + 6
= 5 + 5 + 6 + 6
All requires 4 servers. The last partition has the smallest difference 6−5=1, hence 1 is printed out.
题目来源
浙江大学2021年机试题
重置

提交代码后在此处可查看状态