Posts

Codechef Problem: Counting Pretty Numbers Difficulty Rating:873

Image
  Problem Vasya likes the number  239 239 . Therefore, he considers a number  pretty  if its last digit is  2 2 ,  3 3  or  9 9 . Vasya wants to watch the numbers between  � L  and  � R  (both inclusive), so he asked you to determine how many pretty numbers are in this range. Can you help him? Input The first line of the input contains a single integer  � T  denoting the number of test cases. The description of  � T  test cases follows. The first and only line of each test case contains two space-separated integers  � L  and  � R . Output For each test case, print a single line containing one integer — the number of pretty numbers between  � L  and  � R . Solution: # cook your dish here def is_pretty(number):     last_digit = number % 10     return last_digit == 2 or last_digit == 3 or last_digit == 9 def count_pretty_numbers_in_range(L, R):     cou...

CodeChef Problem : Recent contest problems - Difficulty Rating:793

Image
  CodeChef    Problem  -  Difficulty Rating: 793 Input Format First line will contain  � T , number of test cases. Then the test cases follow. Each test case contains of two lines of input. First line of input contains the total count of problems that appeared in the two recent contests -  � N . Second line of input contains the list of  � N  contest codes. Each code is either  START38  or  LTIME108 , to which each problem belongs. Output Format For each test case, output two integers in a single new line - the first integer should be the number of problems in  START38 , and the second integer should be the number of problems in  LTIME108 . Constraints 1 ≤ � ≤ 10 1 ≤ T ≤ 10 1 ≤ � ≤ 1000 1 ≤ N ≤ 1000 Each of the contest codes will be either  START38  or  LTIME108 . Sample 1: Input Output 4 3 START38 LTIME108 START38 4 LTIME108 LTIME108 LTIME108 START38 2 LTIME108 LTIME108 6 START38 LTIME108 LTIME108 LTIM...

Contact Form

Name

Email *

Message *