олимпиада

Chess problem. The horse and I will walk together across the field

Problem condition: (conditions and testing system) Two chessboard cells are given. It is necessary to determine whether it i ... x1 - 1, y1 + 2, x2, y2) || h(x1 - 1, y1 - 2, x2, y2)) cout << 2; else cout << "NO"; } return 0; }

Common divisors (the program does not work)

For a given positive integer n, find the number of integers x lying in the segment [1, n] such that the number of common divi ... ) print() a += 1 In general, the program does not go, if it is not difficult to write the code, please.

Olympiad task " Small denominators"

Time limit: 2 seconds. Memory limit: 512 MB. Condition: Two fractions are given a/b c/d with non-negative integer numerato ... (int i = 0; i < pos; i++) { cout << r[i] << ' '; cout << r[++i] << '\n'; } }

The permutation problem. C++

Task condition : For a given permutation, you need to determine the inverse. A permutation of N elements is an ordered set ... tion is wrong (in terms of efficiency), have I effectively implemented my own an idea? Can you think of something better?

A simple but unsolved problem with ACMP. C++

Task condition : The deposit in the bank is X rubles. Every year it increases by P percent, after which the fractional part ... em? in the line x *= 1 + p / 100.0 there are no errors with the casts for sure (by 99%) I checked. What could be the problem?

How to determine for a maximum of two comparisons whether there is a triangle with sides of length a, b and c?

Given three numbers: a, b, c. How to determine for a maximum of two comparisons whether there is a triangle with sides of ... everything is clear, but how to do it for 2 comparisons? Ps the question is not educational, met in preparation for sobes :)

Interactive number guessing challenge. C++

Task condition : This is an interactive task. The jury program guesses an integer N (1 ≤ N ≤ 10^9), which your program will ... The program does not pass in time. So it's "stuck" somewhere? But where? And why? In theory, everything should work fine...

ACMP Sorting by Choice

In this task, you are asked to implement selection sorting. An array of integers a0, a1, ..., an-1 is given. Let's sort it ... b[i]= imax; swap(a[i], a[j]); } for (int i = 0; i < n; i++) cout << b[i] << " ";

Help solve the Olympiad problem in computer science about cells on a chessboard

Condition: The chessboard consists of n×m cells, colored black and white in a checkerboard pattern. In this case, the cell in ... : it always turned out half black and white n, m = int(input()), int(input()) print(n * m / 2) This code does not accept.

The task of finding a" simple " digital root. C++

Condition of the task: We define the simple digital root (PCC) of a natural number N as follows. If N is a prime number, the ... t(2^31 - 1) ~ 2^16 = 65536 iterations, which is very feasible. How can I optimize the program? And what could be the problem?

How can I rewrite the solution without using loops?

Problem from the Olympiad 8th grade There is n kg of metal alloy. It is used to make billets with a mass of K kg each. After ... ные: 4 Входные данные: 13 5 3 Выходные: 3 Входные данные: 14 5 3 Выходные: 4 Входные данные: 13 9 4 Выходные: 2

The problem of divisibility by 11. C++

Task condition : For a number to be divisible by 11, the difference between the sum of the digits in even places and the su ... program definitely works somehow crookedly. Please explain to me what I am missing and what I have done wrong in my programs.

Problem with ACMP with incorrect C++solution

Task condition : In a certain state, there are N firms that compete with each other. Each firm has a certain profit per yea ... ives the wrong answer. What could be the problem? Is my idea itself wrong? Or does the program stumble on some special cases?

Help me fix the C++code

The Drunkard Game In the drunkard game, a deck of cards is distributed equally to two players. Next, they reveal one top card ... if(d.empty()){ cout<<"second "<<n; } else cout<<"first "<<n; return 0; }

The problem of multiplying and finding the root of a string. C++

Task condition : Let the string s = be given s1s2...sn. Let's call it the kth (k > 0) power of sk , sk = s1s2... sns1s2 ... f the tests, my solution fails. I suspect that I have implemented the negative degree root poorly. What could be the problem?

Determine on which floor the apartment is located

Given the number of apartments (n), entrances (p), floors (q) and the apartment number itself (k). Determine on which floor a ... } } Console.WriteLine(pod + " " + et); Console.ReadLine(); } } }

The task of dividing the chocolate bar

Task . Condition The chocolate bar has the form of a rectangle divided into n×m slices. The chocolate bar can be broken once ... * m last = area - k full_m = k / n if full_m == (area - last): print('YES') else: print('NO')

runtime error when solving a python problem

Task: Given a tree with n vertices and a number k, we want to find the smallest number of edges, when removing which there i ... en this code on the pros, he went in, i.e. the problem is not in the algorithm. What are the options for why it doesn't work?

How do I find out if there is a loop in a graph?

Don't know how to solve it ? Can you tell me how to solve this problem ? Given the adjacency matrix of an undirected graph, ... дные данные #1 3 0 1 1 1 0 1 1 1 0 Выходные данные #1 NO Входные данные #2 3 0 1 0 1 1 1 0 1 0 Выходные данные #2 YES