PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#GL0000230. Những vé số còn lại (The Lottery)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Những vé số còn lại (The Lottery)
Những vé số còn lại (The Lottery)
Source: UVa
Version: Phuoc Hung OJ Extended
Problem Statement
There are tickets numbered from to . A ticket is removed if its number is divisible by at least one of the chosen positive integers. Count the tickets that are not removed. Chosen integers may repeat.
Input
- First line: integers .
- Second line: chosen positive integers.
Output
Print the number of tickets that remain.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Example 1
Input
10 2
2 3
Output
3
Explanation
The remaining ticket numbers are .
Example 2
Input
20 2
2 4
Output
10
Explanation
All numbers divisible by are already divisible by , so exactly 10 tickets remain.