File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ """
2
+ Problem Link: https://practice.geeksforgeeks.org/problems/confused-pappu/0
3
+
4
+ Pappu is confused between 6 & 9 . He works in billing department of abc company and
5
+ his work is to return the remaining amount to the customers. If actual remaining amount is
6
+ given we need to find the maximum possible extra amount given by the pappu to the customers.
7
+ For ex:- actual remaining amount = 56
8
+ so, maximum possible extra amount = (59 - 56 ) = 3
9
+
10
+ Input
11
+ The first line of the input contains a single integer T denoting the number of test cases.
12
+ The first line of each test case contains N (actual remaining amount).
13
+
14
+ Output
15
+ For each test case, output the maximum possible extra amount in newline.
16
+
17
+ Example
18
+
19
+ Input:
20
+ 3
21
+ 6
22
+ 66
23
+ 666
24
+
25
+ Output:
26
+ 3
27
+ 33
28
+ 333
29
+ """
30
+ def get_real_no (n ):
31
+ new_no = list (n )
32
+ for i in range (len (new_no )):
33
+ if new_no [i ] == '6' :
34
+ new_no [i ] = '9'
35
+ return int ('' .join (new_no ))
36
+
37
+ for _ in range (int (input ())):
38
+ n = input ()
39
+ new_no = get_real_no (n )
40
+ print (new_no - int (n ))
You can’t perform that action at this time.
0 commit comments