UVA-11344 - The Huge One

  • UVa Online Judge 解題結果請於 Submit 後,參閱 uHunt
  • 如果你有任何建議與指教,歡迎於下方留言一起討論喔!
  • 本題選為「20161004 大學程式能力檢定 CPE」題目。

題意概要

試求一個大整數是否能被一個正整數集和中的所有數字整除,集合中的數字範圍: -


Input

First line of input data contains number (). Then tests follow each described on two lines. First line of each test case contains number . Second line contains the number of elements in a set followed by a space and the numbers in the set. Numbers of this set are separated by a space character.


Output

Output one line for each test case: M - Wonderful., if the number is wonderful or M - Simple. if it is not. Replace character with the corresponding number. Refer output data for details.


Sample Input

4
0
12 1 2 3 4 5 6 7 8 9 10 11 12
379749833583241
1 11
3909821048582988049
1 7
10
3 1 2 9

Sample Output

0 - Wonderful.
379749833583241 - Wonderful.
3909821048582988049 - Wonderful.
10 - Simple.
profile-image
David Lu
Hello, I'm David Lu. I am a graduate student in Department of Computer Science at National Chiao Tung University, Taiwan. I am in the Networking and Sensing Systems (NSS) Lab at NCTU. If you have any question, please feel free to contact with me.
comments powered by Disqus