PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#SCKTCUOIKI0008. Đếm các số chia hết cho 3 (Count Multiples of Three)
Bài tập này chưa được xếp vào lộ trình.
Mục lục đề ⌄
Đang đọc
Đếm các số chia hết cho 3 (Count Multiples of Three)
Count Multiples of Three
**Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , count the integers divisible by among , including . Use a loop and a conditional statement to check each integer.
Input
The only line contains the integer .
Output
Print one integer: the number of integers divisible by in the inclusive range from to .
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
11
Output
3
Explanation
The multiples of from through are , , and . The next multiple, , is outside the range. There are exactly such integers, so print 3.
Liên quan
Trong các cuộc thi sau: