結果

問題 No.1409 Simple Math in yukicoder
ユーザー HaaHaa
提出日時 2021-02-26 21:53:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 657 bytes
コンパイル時間 1,490 ms
コンパイル使用メモリ 164,508 KB
実行使用メモリ 8,752 KB
最終ジャッジ日時 2023-07-25 21:03:33
合計ジャッジ時間 35,045 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 615 ms
4,376 KB
testcase_08 TLE -
testcase_09 AC 543 ms
4,376 KB
testcase_10 AC 1,681 ms
4,376 KB
testcase_11 TLE -
testcase_12 AC 1,607 ms
4,376 KB
testcase_13 AC 620 ms
4,376 KB
testcase_14 AC 478 ms
4,380 KB
testcase_15 AC 739 ms
4,380 KB
testcase_16 AC 784 ms
4,376 KB
testcase_17 TLE -
testcase_18 AC 1,374 ms
4,380 KB
testcase_19 AC 1,487 ms
4,380 KB
testcase_20 AC 1,192 ms
4,376 KB
testcase_21 AC 944 ms
4,376 KB
testcase_22 AC 1,783 ms
4,376 KB
testcase_23 AC 371 ms
4,376 KB
testcase_24 AC 291 ms
4,376 KB
testcase_25 AC 1,729 ms
4,380 KB
testcase_26 AC 1,877 ms
4,380 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
#define REP(i,n) for(ll i=0;i<(n);i++)
#define ALL(v) v.begin(),v.end()
constexpr ll MOD=1000000007;
constexpr ll INF=1e18;

ll power(ll x, ll y, ll m){
    x%=m;
    ll ret=1;
    while(y){
        if(y&1) ret=ret*x%m;
        x=x*x%m;
        y>>=1;
    }
    return ret;
}

int main(){
    int t; cin >> t;
    while(t--){
        int v, x; cin >> v >> x;
        int p=v*x+1;
        for(int i=1;i<p;i++){
            if(power(i,x,p)==1)
                cout << i << " ";
        }
        cout << endl;
    }
}
0