oj mrJudge
Toggle navigation
  • Login
    • Forget Password
      Login
User Image

Hello, Stranger

Guest
  • Analysis Mode
  • Problems
    • All Problems
    • Latest Problems
  • Join Us Now
  • Registration
  • Contact Us
  • Infomation
  • About
    • Terms of Use
    • Technical Specifications
    • Credits

7up Batch , stdin/stdout

Registered Users Only

Please login to utilize this feature.

Do note that this website only supports submissions in C++.

statement.html

Problem Description

7-UP is a game that can be played by a group of N children, standing in a circle. Starting from 1, the children take turns shouting the natural numbers in increasing order, going around the circle. For example, in a group of 9 children, the second child will shout 2, 11, 20, 29, and so on. This will go on for exactly K rounds, before the children get tired and stop playing.

However, there is a small catch. If the number that a child is supposed to shout out is a multiple of 7 or contains the digit 7, the child would shout "UP!" in place of the number. So, for example, if a child was supposed to shout 17, he would shout "UP!", as 17 contains the digit 7.

You are the Xth child in a circle with N children. Print out exactly K lines, detailing what you are supposed to shout during each round of the game.

Input

The input will contain one line with exactly three integers, N, K and X.

Output

The output should contain K lines, with each line containing either an integer or the string "UP!".

Limits

For all subtasks: 1 ≤ N, K ≤ 1000, 1 ≤ X ≤ N.

Subtask 1 (13%): N = X = 7.

Subtask 2 (10%): N = X = 1, 1 ≤ K ≤ 10.

Subtask 3 (15%): N = X = 1, 1 ≤ K ≤ 100.

Subtask 4 (22%): N = X = 1.

Subtask 5 (40%): No additional constraints.

Sample Input

9 10 2

Sample Output

2
11
20
29
38
UP!
UP!
65
UP!
83

Tags

Syntax, String Processing

Subtasks and Limits

Subtask Score #TC Time Memory Scoring
11351s256MBMinimum
21051s256MBMinimum
315101s256MBMinimum
422151s256MBMinimum
540261s256MBMinimum
6011s256MBMinimum

Judge Compile Command

g++-8 ans.cpp -o 7up -Wall -Wshadow -static -O2 -lm -m64 -s -w -std=gnu++17 -fmax-errors=512

Accepted Submissions

subIDUserTimeMax Time

Past Submissions

subIDUserTimeScore
mrJudge 09.05.20
Copyright © 2020 mrJudge. All rights reserved.