結果
| 問題 | No.377 背景パターン |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-09-22 17:45:50 |
| 言語 | C++17(clang) (clang++ 22.1.8 + boost 1.92.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 849 bytes |
| 記録 | |
| コンパイル時間 | 3,143 ms |
| コンパイル使用メモリ | 165,616 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2026-09-22 17:46:14 |
| 合計ジャッジ時間 | 20,309 ms |
|
ジャッジサーバーID (参考情報) |
judge5_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 5 |
| other | TLE * 1 -- * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
long long i, j, l, r, mid, p, q, k, t, n, m, a, b, c, d, h, w, ans, cnt, res, arr[1000005];
const long long mod = 1e9 + 7, mod2 = 999993469, inf = 1e18;
string s;
bool check;
long long binpow (long long a, long long b, long long mod){
a %= mod;
long long res = 1;
while (b > 0){
if (b % 2 == 1){
res = res * a % mod;
}
a = a * a % mod;
b /= 2;
}
return res;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> h >> w >> k;
ans = 0;
for (i = 0; i < h; i += 1){
for (j = 0; j < w; j += 1){
c = h / __gcd(i, h);
d = w / __gcd(j, w);
res = __gcd(i, h) * __gcd(j, w) % mod * __gcd(c, d) % mod;
ans = (ans + binpow(k, res, mod)) % mod;
}
}
cout << ans * binpow(h * w, mod - 2, mod) % mod << "\n";
}
vjudge1