結果
問題 | No.644 G L C C D M |
ユーザー |
![]() |
提出日時 | 2017-08-16 20:51:40 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 366 bytes |
コンパイル時間 | 1,411 ms |
コンパイル使用メモリ | 167,568 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-13 13:01:06 |
合計ジャッジ時間 | 7,767 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 13 TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h>using namespace std;int N, M, mod = 1000000007;int main() {cin >> N >> M;int ret = 0;for(int i = 1; i <= N; i++) {for(int j = 1; j < i; j++) {if(i != j && __gcd(i, j) == M) {ret += 2;if(ret >= mod) ret -= mod;}}}for(int i = 1; i <= N - 2; i++) ret = 1LL * ret * i % mod;cout << ret << endl;return 0;}