Star Guardians

면접 대비

시간 제한1초메모리 제한2048 MB

요약
각 사람이 푸는 문제 수와 팀 크기 i에 따른 추가 문제 수 a[i]가 주어질 때, 팀원 평균 문제 수를 최대로 만드는 팀을 고른다.
난이도

쉬움10점 중 3점

유형
정렬, 그리디, 수학, 완전 탐색
정답자
아직 제출이 없습니다

문제

Jenny and Ojas are part of an elite group of competitive programmers called the Star Guardians. Their next job - to do well in the NAQ!

The Star Guardians are working to assemble a team for the NAQ. They are yet to decide their team, but for each person in the group, it is known how many problems that person will solve.

The Star Guardians are also well-versed in teamwork, so they will solve an additional number of problems based solely on the size of their team.

The Star Guardians want to field a team that maximizes the average number of problems solved per team member. Compute the maximum average they can attain. You may assume the NAQ has infinitely many problems, so the Star Guardians will not run out of problems to solve.

입력

The first line of input contains a single integer, nn (1≤n≤10)1 \le n \le 10), the number of Star Guardians.

The next line contains nn integers aa (0≤a≤1090 \le a \le 10^9), with the iith integer being the additional number of problems solved if the Star Guardians field a team of size ii. It is guaranteed that these integers are monotonically increasing.

The next line contains nn integers ss (0≤s≤1080 \le s \le 10^8), which is the number of problems each Star Guardian can solve.

출력

Output a single number, which is the maximum average number of problems per team member attainable. Your output will be considered correct if it has absolute or relative error at most 10−610^{-6} from the correct answer.

예제2

  1. 예제 1

    입력
    2
    283663485 732616075
    0 93763082
    
    예상 출력
    413189578.5
    
  2. 예제 2

    입력
    1
    17109549
    100000000
    
    예상 출력
    117109549.0