A. 慕雪少年的Lucky数字

    传统题 1000ms 256MiB

慕雪少年的Lucky数字

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

Problem Description

Jixiang has a unique theory about lucky numbers: he believes that if the sum of the digits of a positive integer is divisible by 7, then that number is his lucky number.

Now, Jixiang wants to know how many such lucky numbers exist within a certain range. Given two integers l and r, representing a closed interval [l, r], please help Jixiang calculate how many numbers in this interval (including both l and r) satisfy the condition that the sum of their digits is a multiple of 7.

Note: The interval includes both endpoint values l and r.

Input Format

Two integers l and r, separated by a space (1 ≤ l ≤ r ≤ 10^6)

Output Format

An integer representing the count of lucky numbers in the interval [l, r]

Sample Input #1

1 20

Sample Output #1

2

Sample Input #2

7 7

Sample Output #2

1

Explanation/Hint

Explanation for Sample 1: Between 1 and 20, the number 7 (7÷7=1) and the number 16 (1+6=7÷7=1) are lucky numbers.

This problem uses Subtask bundling test

【XJS-C5-Div5】XJSOI 春节大月赛 Round 3 & 勰码可达鸭合作赛 Round 1

未参加
状态
已结束
规则
IOI
题目
5
开始于
2026-2-7 0:00
结束于
2026-2-14 0:00
持续时间
2 小时
主持人
参赛人数
10