ACMSGURU 403 - Scientific Problem

2021-08-11 11:12:12 浏览数 (2)

Scientific Problem

Problem Description

Once upon a time Professor Idioticideasinventor was travelling by train. Watching cheerless landscape outside the window, he decided to invent the theme of his new scientific work. All of a sudden a brilliant idea struck him: to develop an effective algorithm finding an integer number, which is x times less than the sum of all its integer positive predecessors, where number x is given. As far as he has no computer in the train, you have to solve this difficult problem.

Input

The first line of the input file contains an integer number x (1 <= x <= 10^9).

Output

Output an integer number - the answer to the problem.

Example(s)

sample input

sample output

1

3

2

5

Solution

代码语言:javascript复制
#include <bits/stdc  .h>

int main() {
    std::ios::sync_with_stdio(false);

    int x{};
    std::cin >> x;

    std::cout << (x << 1 | 1) << std::endl;
    return 0;
}

0 人点赞