Posts

Showing posts from September, 2020

New Start day 1 30/09/2020 codeforces(1A Theatre Square)

Theatre Square Question: Theatre Square source: (https://codeforces.com/problemset/problem/1/A) Theatre Square in the capital city of Berland has a rectangular shape with the size  n  ×  m  meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size  a  ×  a . What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square. Input The input contains three positive integer numbers in the first line:  n ,   m,  and  a  (1 ≤   n ,  m ,  a  ≤ 109). Output Write the needed number of flagstones. Examples input 6 6 4 output 4   My Logic: We can cover larger area than the given area so we can actually use a separate given ...

New Start day 1 30/09/2020 Codeforces problem 231A Team

Question: source( codeforces: https://codeforces.com/problemset/problem/231/A) Team One day three best friends Petya, Vasya and Tonya decided to form a team and take part in programming contests. Participants are usually offered several problems during programming contests. Long before the start the friends decided that they will implement a problem if at least two of them are sure about the solution. Otherwise, the friends won't write the problem's solution. This contest offers  n  problems to the participants. For each problem we know, which friend is sure about the solution. Help the friends find the number of problems for which they will write a solution. Input The first input line contains a single integer  n  ( 1 ≤  n  ≤ 1000 ) — the number of problems in the contest. Then  n  lines contain three integers each, each integer is either  0  or  1 . If the first number in the line equals  1 , then Petya is sure about the problem's solu...

New start day 1 : 30/09/2020 (codeforces 71A) Way to long strings

 Question:  source (codeforces: https://codeforces.com/problemset/problem/71/A) Way too long strings   Sometimes some words like " localization " or " internationalization " are so long that writing them many times in one text is quite tiresome. Let's consider a word  too long if its length is  strictly more  than  10  characters. All too long words should be replaced with a special abbreviation. This abbreviation is made like this: we write down the first and the last letter of a word and between them, we write the number of letters between the first and the last letters. That number is in the decimal system and doesn't contain any leading zeroes. Thus, " localization " will be spelled as " l10n ", and " internationalization » will be spelled as " i18n ". You are suggested to automatize the process of changing the words with abbreviations. At that, all too long words should be replaced by the abbreviation and the words th...

New start day 1: 30/09/2020 codeforces (4A) Watermelon

 Question: source (codeforces:https://codeforces.com/problemset/problem/4/A) Watermelon One hot summer day Pete and his friend Billy decided to buy a watermelon. They chose the biggest and the ripest one, in their opinion. After that, the watermelon was weighed, and the scales showed   w   kilos. They rushed home, dying of thirst, and decided to divide the berry, however they faced a hard problem. Pete and Billy are great fans of even numbers, that's why they want to divide the watermelon in such a way that each of the two parts weighs even the number of kilos, at the same time the parts don't need to be equal. The boys are extremely tired and want to start their meal as soon as possible, that's why you should help them and find out if they can divide the watermelon in the way they want. For sure, each of them should get a part of a positive weight. Input The first (and the only) input line contains integer number  w  ( 1 ≤  w  ≤ 100 ) — the weight of the waterm...