結果
| 問題 |
No.1409 Simple Math in yukicoder
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2021-02-26 22:40:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,094 bytes |
| コンパイル時間 | 2,073 ms |
| コンパイル使用メモリ | 201,120 KB |
| 最終ジャッジ日時 | 2025-01-19 06:09:40 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 1 WA * 57 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/modint>
using namespace std;
using namespace atcoder;
void solve()
{
int v, x;
cin >> v >> x;
if (x == 1)
{
cout << 1 << endl;
return;
}
modint::set_mod(x * v + 1);
for (int i = 2; i <= x * v; i++)
{
if (modint(i).pow(v).val() != 1)
{
int k = modint(i).pow(v).val();
vector<int> ans;
ans.push_back(1);
for (int j = 1; j < x; j++)
{
ans.push_back(ans.back() * k % (x * v + 1));
}
sort(ans.begin(), ans.end());
for (int j = 0; j < x; j++)
{
cout << ans.at(j);
if (j == x - 1)
{
cout << endl;
}
else
{
cout << " ";
}
}
break;
}
}
}
int main(int argc, char const *argv[])
{
int t;
cin >> t;
for (int i = 0; i < t; i++)
{
solve();
}
return 0;
}
trineutron