Description
Luffy wants to find one piece through the great route, and there are many other pirates on the road to stop him.
He knew that as long as he defeated the pirate with some physical strength, the pirate would always escort him.
On the way, he will meet N pirates in turn, each pirate has its own force value and the physical value required to defeat him.
If Luffy did not defeat a certain pirate, and this pirate's force value was greater than the sum of the pirate's force value escorting him, the pirate would defeat him.
Luffy wants to know that if he wants to successfully cross a great route without being defeated, he needs at least as much physical strength
Input
The first line contains the integer N, indicating the number of pirates.
The second line contains N integers d1, d2, ..., dn, which represent the force value of each pirate.
The third line contains N integers p1, p2, ..., pn, which represent the physical value required to defeat N pirates.
Data range:1≤N≤50,1≤di≤10^12,1≤pi≤2
Output
An integer is output, indicating the minimum physical strength required.
Sample Input 1
3
8 5 10
1 1 2
Sample Output 1
2
Personal Answer (using language:JAVA) Not necessarily right
public class Main {
public static void main(String[] args) {
System.out.println("Unsolved");
}
}
Welcome to communicate!
路飞在伟大航路上寻找一片,面对众多海盗的阻挠,他必须战胜足够强大的海盗才能获得护航。本篇分析了路飞如何计算所需最小力量值以确保在不被击败的情况下成功穿越伟大航线。
382

被折叠的 条评论
为什么被折叠?



