0%

Codeforces 122A - Lucky Division

Lucky Division

Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

閱讀全文 »

Codeforces 721A - One-dimensional Japanese Crossword

One-dimensional Japanese Crossword

Recently Adaltik discovered japanese crosswords. Japanese crossword is a picture, represented as a table sized a × b squares, and each square is colored white or black. There are integers to the left of the rows and to the top of the columns, encrypting the corresponding row or column. The number of integers represents how many groups of black squares there are in corresponding row or column, and the integers themselves represents the number of consecutive black squares in corresponding group (you can find more detailed explanation in Wikipedia https://en.wikipedia.org/wiki/Japanese_crossword).

閱讀全文 »

CodeForces 148A - Insomnia cure

Insomnia cure

«One dragon. Two dragon. Three dragon», — the princess was counting. She had trouble falling asleep, and she got bored of counting lambs when she was nine.

閱讀全文 »

Codeforces 118B - Present from Lena

Present from Lena

Vasya’s birthday is approaching and Lena decided to sew a patterned handkerchief to him as a present. Lena chose digits from 0 to n as the pattern. The digits will form a rhombus. The largest digit n should be located in the centre. The digits should decrease as they approach the edges. For example, for n = 5 the handkerchief pattern should look like that:

閱讀全文 »

Codeforces 977A - Simple Game

Simple Game

One day Misha and Andrew were playing a very simple game. First, each player chooses an integer in the range from 1 to n. Let’s assume that Misha chose number m, and Andrew chose number a.

閱讀全文 »

Codeforces 263A - Beautiful Matrix

Beautiful Matrix

You’ve got a 5 × 5 matrix, consisting of 24 zeroes and a single number one. Let’s index the matrix rows by numbers from 1 to 5 from top to bottom, let’s index the matrix columns by numbers from 1 to 5 from left to right. In one move, you are allowed to apply one of the two following transformations to the matrix:

閱讀全文 »

Codeforces 977A - Wrong Subtraction

Wrong Subtraction

Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:

閱讀全文 »