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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.