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 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

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

Powered by Blogger.