QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#494085 | #5003. Etched Emerald Orbs | Railgun2334 | WA | 0ms | 3668kb | C++14 | 2.7kb | 2024-07-27 14:02:20 | 2024-07-27 14:02:20 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define re read()
#define MOD 998244353
#define i128 __int128
#define PII pair<int,int>
#define ull unsigned long long
#define INF 9223372036854775800
#define fr(i, x, y) for (int i = x, p = y; i <= p; ++i)
#define rp(i, x, y) for (int i = x, p = y; i >= p; --i)
#define Timeok ((double)clock() / CLOCKS_PER_SEC < MAX_TIME)
const double MAX_TIME = 1.0 - 0.0032;
inline i128 read() {
i128 x = 0, f = 0;
char ch = getchar();
while (!isdigit(ch))
f |= (ch == '-'), ch = getchar();
while (isdigit(ch))
x = (x << 1) + (x << 3) + (ch ^= 48), ch = getchar();
return f ? -x : x;
}
void write(i128 x) {
if (x < 0)
putchar('-'), x = -x;
if (x > 9)
write(x / 10);
putchar(x % 10 + 48);
}
inline void W(i128 x, char ch) {
write(x);
putchar(ch);
}
ll ksm(ll a, ll b, ll mod) { //快速幂mod
a %= mod;
ll res = 1;
while (b > 0)
{
if (b & 1)
res = res * a & mod;
a = a * a % mod;
b >>= 1;
}
return res;
}
ll ksm(ll a, ll b) { //快速幂
ll res = 1;
while (b > 0)
{
if (b & 1)res = res * a;
a = a * a;
b >>= 1;
}
return res;
}
PII fib(ll n) { //计算第n和n+1位斐波那契数
if (n == 0)return{ 0,1 };
auto p = fib(n >> 1);
ll c = p.first * (2 * p.second - p.first);
ll d = p.first * p.first + p.second * p.second;
if (n & 1)
return { d,c + d };
else
return { c,d };
}
ll exgcd(ll a, ll b, ll& x, ll& y) { //扩展欧几里得
ll x1 = 1, x2 = 0, x3 = 0, x4 = 1;
while (b != 0) {
ll c = a / b;
std::tie(x1, x2, x3, x4, a, b) =
std::make_tuple(x3, x4, x1 - x3 * c, x2 - x4 * c, b, a - b * c);
}
x = x1, y = x2;
return a;
}
bool liEu(ll a, ll b, ll c, ll& x, ll& y) {
ll d = exgcd(a, b, x, y);
if (c % d != 0) return 0;
ll k = c / d;
x *= k;
y *= k;
return 1;
}
ll r[105]; //取模数
ll CRT(int k, ll* a, ll* r) { //中国剩余定理
ll n = 1, ans = 0;
for (int i = 1; i <= k; i++) n = n * r[i];
for (int i = 1; i <= k; i++) {
ll m = n / r[i], b, y;
exgcd(m, r[i], b, y); // b * m mod r[i] = 1
ans = (ans + a[i] * m * b % n) % n;
}
return (ans % n + n) % n;
}
/*
ll Lucas(ll n, ll m, ll p) {
if (m == 0) return 1;
return (C(n % p, m % p, p) * Lucas(n / p, m / p, p)) % p;
}*/
int gcd(int a, int b) {
return b == 0 ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
return a * b / gcd(a, b);
}
/*------------C-O-D-E------------*/
const int N = 1e5 + 4;
//int n, m, M, mod=998244353;
void solve()
{
i128 n;
n=read();
if(n%2==0||n==1)
{
cout<<-1;
return;
}
i128 m=(n+1)/2;
write(m);
cout<<" ";
write(n*m);
}
int main()
{
ll T = 1;
//cin>>T;
while (T--)
{
solve();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
input:
5
output:
3 15
result:
ok single line: '3 15'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
7
output:
4 28
result:
ok single line: '4 28'
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3604kb
input:
2625
output:
1313 3446625
result:
wrong answer 1st lines differ - expected: '2415 2875', found: '1313 3446625'