PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SP0000056. Charlie và các số nguyên tố (Charlie and Prime Numbers)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Charlie và các số nguyên tố (Charlie and Prime Numbers)
Charlie and Prime Numbers
Source: CodeChef
Version: Phuoc Hung OJ Extended
Problem Statement
Charlie chooses two positive integers and with . He wants the sum of all prime numbers in the inclusive interval . A prime is an integer greater than with exactly two positive divisors, and itself. If the range contains no primes, the sum is .
Input
One line contains positive integers and .
Output
Print one integer: the sum of all primes from through , inclusive.
Subtasks
- Subtask 1 (30 points): .
- Subtask 2 (30 points): .
- Subtask 3 (40 points): .
Examples
Input
2 10
Output
17
Explanation
The primes in are ; are composite. Add them step by step: , then , then . Therefore print 17.