Logo
(追記) (追記ここまで)

16409번 - Coprime Integers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB60335224756.393%

문제

Given intervals [a, b] and [c, d], count the number of ordered pairs of co-prime integers (x, y) such that a ≤ x ≤ b and c ≤ y ≤ d. Coprime integers have no common factor greater than 1.

입력

The input consists of a single line of four space-separated integers a, b, c, and d. These integers satisfy the bounds (1 ≤ a ≤ b ≤ 107, 1 ≤ c ≤ d ≤ 107).

출력

Print a single integer: the number of coprime pairs (x, y) with a ≤ x ≤ b, c ≤ y ≤ d.

제한

예제 입력 1

1 5 1 5

예제 출력 1

19

예제 입력 2

12 12 1 12

예제 출력 2

4

예제 입력 3

1 100 1 100

예제 출력 3

6087

힌트

출처

ICPC > Regionals > North America > Mid-Central Regional > 2018 Mid-Central Regional Programming Contest E번

ICPC > Regionals > North America > Pacific Northwest Regional > 2018 Pacific Northwest Region Programming Contest > Division 1 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /