結果
| 問題 |
No.1158 GCD Products easy
|
| ユーザー |
|
| 提出日時 | 2022-08-20 15:46:05 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 97 ms / 2,000 ms |
| コード長 | 689 bytes |
| コンパイル時間 | 1,737 ms |
| コンパイル使用メモリ | 147,044 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-09 08:23:30 |
| 合計ジャッジ時間 | 3,068 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 25 |
ソースコード
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<random>
#include<bitset>
#include<cassert>
#include<complex>
#include<fstream>
#include<cstdlib>
#include<functional>
#include<array>
using namespace std;
typedef long long ll;
const int mod=1e9+7;
const int dx[]={1,0,0,-1},dy[]={0,1,-1,0};
int main(){
int a,b,n;
cin>>a>>b>>n;
int ans=1;
for(int S=0;S<pow(b-a+1,n);S++){
int S2=S,g=0;
for(int i=0;i<n;i++){
g=gcd(g,a+S2%(b-a+1));
S2/=b-a+1;
}
ans=(ll)ans*g%mod;
}
cout<<ans<<endl;
}