QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#494746 | #5003. Etched Emerald Orbs | Ink_bai | WA | 0ms | 3744kb | C++23 | 1.2kb | 2024-07-27 16:48:35 | 2024-07-27 16:48:36 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned long long
#define int long long
#define endl '\n'
const int N = 1e4 + 5;
typedef pair<int, int> PII;
#define MAX LONG_LONG_MAX
int a[N], b[N], c[N];
std::string to_string_(__int128 value)
{
if (value == 0)
return "0";
std::string result;
bool is_negative = (value < 0);
if (is_negative)
value = -value;
while (value > 0)
{
result.push_back('0' + (value % 10));
value /= 10;
}
if (is_negative)
result.push_back('-');
std::reverse(result.begin(), result.end());
return result;
}
void solve()
{
int k;
cin >> k;
__int128_t res = k + 1;
double q;
for (;; res++)
{
__int128_t x = res * (res - k);
q = sqrt(static_cast<double>(x));
if (q - static_cast<int>(q) == 0)
{
break;
}
}
string a = to_string_(res - static_cast<int>(q));
string b = to_string_(res + static_cast<int>(q));
cout << a << ' ' << b << endl;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
input:
5
output:
3 15
result:
ok single line: '3 15'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
7
output:
4 28
result:
ok single line: '4 28'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
2625
output:
2415 2875
result:
ok single line: '2415 2875'
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
3874168794131721959
output:
3874168709221017040 3874168879042430600
result:
wrong answer 1st lines differ - expected: '3744304003028637896 4013365524702817208', found: '3874168709221017040 3874168879042430600'