题目描述
Problem Background
This problem is a submission-based answer problem. You can download the input file from the "Attachments."
Problem Description
Alice and Bob are exceptionally intelligent individuals who can devise the optimal strategy for various games. They are invited to a TV show called "The Ultimate Brain" to play a game. The host writes down three positive integers \( s \), \( m \), and \( n \), and then informs both Alice and Bob that \( s \leq m \leq n \) and the value of \( s \). (That is, \( s \) is the lower bound for the numbers \( m \) and \( n \) they need to guess.) The host then privately tells Alice the product of \( m \) and \( n \), and separately tells Bob the sum of \( m \) and \( n \).
Of course, if someone knows both the product and the sum of \( m \) and \( n \), they can easily determine the values of \( m \) and \( n \). However, Alice and Bob each only know one of these pieces of information and can only answer the host's questions without communicating with each other. Starting with either Alice or Bob (as specified in the input), the host alternately asks Alice/Bob if they know the values of \( m \) and \( n \), to which Alice/Bob can only respond with "yes" or "no."
For the sake of the show's entertainment, the host wants Alice and Bob to both know the values of \( m \) and \( n \) after a total of \( t \) "no" responses. The host now seeks your help to construct a pair of \( m \) and \( n \) that meets these conditions.
Input Format
A single line in the format s <name> t (without quotes), where \( s \) and \( t \) are defined as per the problem description (note that Alice and Bob know the value of \( s \)), and <name> is either "Alice" or "Bob" (without quotes), indicating the first person the host asks.
Output Format
A single line containing two numbers separated by a space, representing a pair of \( m \) and \( n \) that satisfies the requirements. If there are multiple solutions, output the one with the smallest sum of \( m \) and \( n \). If there are still multiple solutions, output the one with the smallest \( m \) among those with the smallest sum. The input guarantees a solution exists.
Sample Input and Output
Input Sample #1
5 Bob 2
Output Sample #1
6 10
Input Sample #2
2 Alice 3
Output Sample #2
4 4
Notes
Sample 1 Explanation:
The host informs Alice and Bob that \( 5 \leq m \leq n \), privately tells Alice \( mn = 60 \), and privately tells Bob \( m + n = 16 \).
The host asks Bob if he knows \( m \) and \( n \), to which Bob replies "no."
The host asks Alice if she knows \( m \) and \( n \), to which Alice replies "no."
The host asks Bob if he knows \( m \) and \( n \), to which Bob replies "yes."
The host asks Alice if she knows \( m \) and \( n \), to which Alice replies "yes."
Sample 2 Explanation:
The host informs Alice and Bob that \( 2 \leq m \leq n \), privately tells Alice \( mn = 16 \), and privately tells Bob \( m + n = 8 \).
The host asks Alice if she knows \( m \) and \( n \), to which Alice replies "no."
The host asks Bob if he knows \( m \) and \( n \), to which Bob replies "no."
The host asks Alice if she knows \( m \) and \( n \), to which Alice replies "no."
The host asks Bob if he knows \( m \) and \( n \), to which Bob replies "yes."
The host asks Alice if she knows \( m \) and \( n \), to which Alice replies "yes."
Data Constraints:
For 40% of the test cases, \( t = 2 \).
For 100% of the test cases, \( 1 \leq s \leq 200 \), \( 2 \leq t \leq 15 \), and the input guarantees a solution exists.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分