Codeforces Round #802 (Div. 2) 1700B. Palindromic Numbers Solution



 Problem Link: https://codeforces.com/contest/1700/problem/B

Solution in Python :

  1. test=int(input())
  2. while test:
  3. test-=1
  4. num=int(input())
  5. str=int(input())
  6. str2=int("1"*num)
  7. if str>str2:
  8. print(int("1"*(num+1))-str)
  9. else:
  10. print(int("9"*num)-str)

No comments

Most View Post

Recent post

Codeforces Round 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.