#P11784. 「FAOI-R4」问题跳转
「FAOI-R4」问题跳转
Description
Eventually, Little M finds a feature called "Problem Redirection" on Luogu's homepage. By entering a problem ID into the input box, users can redirect to the corresponding problem. The URL format is https://www.luogu.com.cn/problem/<PID>, where <PID> is the problem ID entered by the user.
Luogu's problem IDs follow special rules:
- The first character is one of
PBCASUT, and all characters are visible characters in ASCII code within . - IDs starting with
Pare "Main Library Problems", which consist ofPfollowed by a string of digits, e.g.,P1145orP10000.
When the user enters a "Main Library Problem" ID, the leading P can be omitted. For example, entering 1001 will redirect to P1001.
Given the problem ID entered by Little M, output the corresponding URL.
Input Format
The first line contains a positive integer — the number of test cases.
For each test case, input a string representing the problem ID.
Output Format
For each test case, output a string representing the corresponding problem URL.
9
1001
P1234
B2027
U76533
T512682
CF10A
AT_abc114_d
SP11470
UVA13277
https://www.luogu.com.cn/problem/P1001
https://www.luogu.com.cn/problem/P1234
https://www.luogu.com.cn/problem/B2027
https://www.luogu.com.cn/problem/U76533
https://www.luogu.com.cn/problem/T512682
https://www.luogu.com.cn/problem/CF10A
https://www.luogu.com.cn/problem/AT_abc114_d
https://www.luogu.com.cn/problem/SP11470
https://www.luogu.com.cn/problem/UVA13277
Hint
Sample Explanation
For the first test case, 1001 is a Main Library Problem with the leading P omitted, so the URL is https://www.luogu.com.cn/problem/P1001.
For the second test case, P1234 is already a valid ID, so the URL remains unchanged.
Constraints
Subtasks are used in this problem.
- Subtask 1 (50 pts): The first character of the input string is guaranteed not to be a digit.
- Subtask 2 (50 pts): No additional constraints.
For all test cases, it is guaranteed that and The input problem ID is guaranteed to be valid (or once existed) and has a length not exceeding 100 characters. The input IDs contains only visible characters in ASCII code within .
京公网安备 11011102002149号