QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587446#9381. 502 Bad GatewayPonyHexWA 352ms3636kbC++201.5kb2024-09-24 19:59:452024-09-24 19:59:45

Judging History

你现在查看的是最新测评结果

  • [2024-09-24 19:59:45]
  • 评测
  • 测评结果:WA
  • 用时:352ms
  • 内存:3636kb
  • [2024-09-24 19:59:45]
  • 提交

answer

//#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
using namespace std;
#define ll long long
#define double long double
#define lc u<<1
#define rc u<<1|1
#define X first
#define Y second
//#define int long long
const int N = 1e5 + 50;
const int M = 5e5 + 5;
const ll maxm = 1e18 + 5;
const ll mod = 998244353;
int dx[] = { -1,0,1,0 };
int dy[] = { 0,1,0,-1 };
//random_shuffle(id + 1, id + n + 1);
ll ksm(ll a, ll b);
ll gcd(ll a, ll b);



void solve()
{
	//最优的策略,如果是让我来,我会选择见好就收,也就是说,如果我选到了平均以左,我会直接走
	//如果选到平均以右,我会选择,继续,但是这样不对,我们应该看看代价
	//如果当前的位置为k,那么我们选择策略1的收益是1/1,选择策略2的收益是((k-1+k-2+..+1)-(n-k+n-1-k+...+k+1-k))/n
	//得看哪种收益大,如果第一种大,选1,否则选2

	//真的假的,怎么看起来是(1+2+..+n)/n;
	ll n; cin >> n;
	ll a = n * (n + 1) / 2; ll b = n;
	cout << (n + 1) / gcd(n + 1, 2) << " " << 2 / gcd((n + 1), 2) << endl;
	return;
}


signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int T = 1;
	cin >> T;
	while (T--)
		solve();
	return 0;
}

/*PonyHex*/


ll ksm(ll a, ll b) {
	ll base = a;
	ll ans = 1;
	while (b) {
		if (b & 1)ans *= base % mod;
		ans %= mod;
		base *= base; base %= mod;
		b >>= 1;
	}
	return ans % mod;
}
ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 352ms
memory: 3636kb

input:

1000000
1
1000000000
1
1
1000000000
1
1000000000
1
1
1
1000000000
1
1
1000000000
1
1000000000
1000000000
1
1000000000
1
1
1000000000
1
1000000000
1000000000
1
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1
1
1000000000
1
1000000000
1000000000
1000000000
1000000000
1
1
1
10000000...

output:

1 1
1000000001 2
1 1
1 1
1000000001 2
1 1
1000000001 2
1 1
1 1
1 1
1000000001 2
1 1
1 1
1000000001 2
1 1
1000000001 2
1000000001 2
1 1
1000000001 2
1 1
1 1
1000000001 2
1 1
1000000001 2
1000000001 2
1 1
1000000001 2
1000000001 2
1000000001 2
1000000001 2
1000000001 2
1000000001 2
1 1
1 1
1000000001 ...

result:

wrong answer 2nd lines differ - expected: '1999961560 44721', found: '1000000001 2'