Prime FriendTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4659 Accepted Submission(s): 952 Problem Description Besides the ordinary Boy Friend and Girl Friend, here we define a more academic kind of friend: Prime Friend. We call a nonnegative integer A is the integer B’s Prime Friend when the sum of A and B is a prime. Input The first line contains a single integer T, indicating the number of test cases. Output For each test case, output the case number first, then the minimum common prime friend of A and B, if not such number exists, output -1. Sample Input 2 2 4 3 6 Sample Output Case 1: 1 Case 2: -1 Author iSea@WHU Source Recommend #include<iostream> |
素数朋友 prime friend
猜你喜欢
转载自blog.csdn.net/qq_41325698/article/details/81561994
今日推荐
周排行