Hurra!
InterviewTime limit6sMemory limit1024 MB
Print the numbers 1 to N, replacing multiples of 7 with Hurra!, multiples of 11 with Super!, and multiples of both with Wiwat!.
- Level
Easy1 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Little Bajtynka likes counting, and she especially loves the numbers 7 and 11. Despite her teachers' best efforts, Bajtynka solemnly celebrates every number divisible by 7 by shouting (or writing) "Hurra!" instead of its name. Her counting may look like this:
. . . , 5, 6, Hurra!, 8, 9, . . .
or like this:
. . . , 12, 13, Hurra!, 15, 16, . . .
Every number divisible by 11 is replaced in the same way by "Super!" (for example: . . . , 31, 32, Super!, 34, . . . ). If Bajtynka meets a number divisible by both 7 and 11, she calls out "Wiwat!" instead. The word is a bit archaic, but history is her favorite subject after computer science.
Give Bajtynka a birthday present. Write a program that counts up to large numbers for her.
Input
Your program reads one integer N from the standard input. N is at least 1 and at most 1,000,000.
Output
Print the numbers from 1 to N the way Bajtynka would say them, in order. Print each item on its own line.