K 2K Game
InterviewTime limit1sMemory limit256 MB
Print how many integers from 1 to N have a units digit different from both the units digits of K and 2K, then list those integers.
- Level
Easy2 of 10
- Topics
- Implementation, Math, Brute force
- Solved
- No attempts yet
Problem
To test the concentration of new students, Psychim developed the following simple game.
- Two integers and are given.
- For a positive integer , let be the units digit of . You say all integers with such that and , in increasing order.
Since you find it tedious to work out units digits one by one, you decide to write a program in secret to win the game. Write a program that prints the full list of numbers you must say.
Input
Two integers and are given, separated by a space.
Output
On the first line, print the count of numbers you must say.
On the second line, print all the numbers you must say on one line. If there are no numbers to say, leave the second line empty. The numbers must be printed in increasing order.