列表

详情


NC211824. SqrtApproaching

描述

Given three positive integers , where is NOT a perfect square number, you should find two positive integers satisfying .

You can assume that solution always exists, and you should print any one of them.

输入描述

The first line contains one integer .

The second line contains one integer .

The third line contains one integer .

It is guaranteed that is NOT a perfect square number.

输出描述

The first line contains one integer .

The second line contains one integer .

示例1

输入:

2
1
2

输出:

3
2

说明:

It can be shown that (1\times 3 - 2\times 2)(3-2\times\sqrt{2}) = -0.1715728752538099023966225515806\cdots < 0.

原站题解

上次编辑到这里,代码来自缓存 点击恢复默认模板

pypy3 解法, 执行用时: 345ms, 内存消耗: 40608K, 提交时间: 2022-02-07 09:25:37

A=int(input());
B=int(input());
n=int(input());
print(n*(A+B));
print(n*B+A);

Python3(3.9) 解法, 执行用时: 411ms, 内存消耗: 4052K, 提交时间: 2020-10-26 13:08:36

A=int(input())
B=int(input())
n=int(input())
print(A*n+B*n)
print(A+B*n)

pypy2(pypy2.7.13) 解法, 执行用时: 280ms, 内存消耗: 42508K, 提交时间: 2020-10-25 19:22:28

A = input()
B = input()
n = input()
print(A*n+B*n)
print(A+B*n)

Python(2.7.3) 解法, 执行用时: 415ms, 内存消耗: 3324K, 提交时间: 2020-10-29 22:30:48

A=input()
B=input()
n=input()
print(A*n+B*n)
print(A+B*n)

上一题