0

What am I doing wrong? Even though I am getting the desired output, it is showing me "wrong answer" when I try to submit my code

t=int(input()) while(t>0): if(t>=1 and t<=30): a,b=map(int,input().split()) rem=a%b choc=0 if(rem==0): choc=1 else: choc=rem print(choc) t=t-1 Q: On her 18th birthday Leena decided to give chocolates as return gift to all invitees. Number of chocolates given to every person is to be decided according to the score of the game they all were playing. But for sure at least one chocolate will be given to everyone. She planned a game in which everyone got two scores. She decided number of chocolates will be remainder of the bigger score with smaller score. Input Format First line contains number of invitees or the test cases t. Then t test cases follow. Each line of the test case two space separated values A,B i.e. scores achieved by individual invitee. Sample Input: 2 6 3 8 3 Constraints 1<=T<=30 1<=A<=1000 1<=B<=1000 Output Format Print the minimum number of chocolates that should be given so that sum of all three (two scores and number of chocolate) produces a prime number. **Explanation ** In first case, invitee scored 6 and 3, so one chocolate is given to him because 6%3 = 0. Similarly for other test case. Sample Output 1 2

30th Aug 2022, 5:03 PM
ss7
1 Antwort
+ 4
Up to choc= rem your code is OK How about A+B + chocolate must be a prime? This part is missing. Go to internet and find all primes up to 1000. Put them into a list and find the smallest prime >= choc.
30th Aug 2022, 5:44 PM
Oma Falk
Oma Falk - avatar