Posts

Showing posts from December, 2019

SPOJ problems - 1,2,42,11,24,4

TEST - Life, the Universe, and Everything https://www.spoj.com/problems/TEST/ PRIME1 - Prime Generator - IMPORTANT   https://www.spoj.com/problems/PRIME1/ ADDREV - Adding Reversed Numbers https://www.spoj.com/problems/ADDREV/ FCTRL - Factorial - IMPORTANT https://www.spoj.com/problems/FCTRL FCTRL2 - Small factorials https://www.spoj.com/problems/FCTRL2/ ONP - Transform the Expression https://www.spoj.com/problems/ONP/

Pin Code - codeforces

B. PIN Codes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A PIN code is a string that consists of exactly  4 4  digits. Examples of possible PIN codes:  7013 ,  0000  and  0990 . Please note that the PIN code can begin with any digit, even with  0 . Polycarp has  n n  ( 2 ≤ n ≤ 10 2 ≤ n ≤ 10 ) bank cards, the PIN code of the  i i -th card is  p i p i . Polycarp has recently read a recommendation that it is better to set different PIN codes on different cards. Thus he wants to change the minimal number of digits in the PIN codes of his cards so that all  n n  codes would become different. Formally, in one step, Polycarp picks  i i -th card ( 1 ≤ i ≤ n 1 ≤ i ≤ n ), then in its PIN code  p i p i  selects one position (from  1 1  to  4 4 ), and changes the digit in this position to any other. He needs to c...

Sweet Problem - codeforces

A. Sweet Problem time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have three piles of candies: red, green and blue candies: the first pile contains only red candies and there are  r r  candies in it, the second pile contains only green candies and there are  g g  candies in it, the third pile contains only blue candies and there are  b b  candies in it. Each day Tanya eats exactly two candies of different colors. She is free to choose the colors of eaten candies: the only restriction that she can't eat two candies of the same color in a day. Find the maximal number of days Tanya can eat candies? Each day she needs to eat  exactly  two candies. Input The first line contains integer  t t  ( 1 ≤ t ≤ 1000 1 ≤ t ≤ 1000 ) — the number of test cases in the input. Then  t t  test cases follow. Each test case is given as a separate li...