結果
問題 | No.1409 Simple Math in yukicoder |
ユーザー |
![]() |
提出日時 | 2021-02-26 21:53:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 657 bytes |
コンパイル時間 | 1,393 ms |
コンパイル使用メモリ | 166,032 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-02 14:34:27 |
合計ジャッジ時間 | 33,199 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 TLE * 4 -- * 32 |
ソースコード
#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; } }