B. Petya and Square time limit per test:2 secondsmemory limit per test: 256 megabytesinput/output standard input /standard output Little Petya loves playing with squares. Mum bought him a square 2n × 2n in size. Petya marked a cell inside the square and now he is solving the following task. The task is to draw a broken line that would go along the grid lines and that would cut the square into two equal parts. The cutting line should not have any common points with the marked cell and the resulting two parts should be…
Category: Tutorial
112A – Petya and Strings : Codeforces Solution
A. Petya and Strings time limit per test:2 secondsmemory limit per test:256 megabytesinput/output :standard input /standard output Little Petya loves presents. His mum bought him two strings of the same size for his birthday. The strings consist of uppercase and lowercase Latin letters. Now Petya wants to compare those two strings lexicographically. The letters’ case does not matter, that is an uppercase letter is considered equivalent to the corresponding lowercase letter. Help Petya perform the comparison. InputEach of the first two lines contains a bought string. The strings’ lengths range…
158A – Next Round : Codeforces Solution
Question : A. Next Round time limit per test :3 secondsmemory limit per test: 256 megabytesinput/output : standard input / standard output “Contestant who earns a score equal to or greater than the k-th place finisher’s score will advance to the next round, as long as the contestant earns a positive score…” — an excerpt from contest rules. A total of n participants took part in the contest (n ≥ k), and you already know their scores. Calculate how many participants will advance to the next round. Input The first line of the input contains…