結果
問題 |
No.1253 雀見椪
|
ユーザー |
![]() |
提出日時 | 2024-04-13 14:30:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 659 bytes |
コンパイル時間 | 1,977 ms |
コンパイル使用メモリ | 197,784 KB |
最終ジャッジ日時 | 2025-02-21 01:03:20 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/modint> using namespace std; using mint = atcoder::modint1000000007; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int t; cin >> t; for (; t--;) { long long n, ag, bg, ac, bc, ap, bp; cin >> n >> ag >> bg >> ac >> bc >> ap >> bp; mint g = mint(ag) / bg, c = mint(ac) / bc, p = mint(ap) / bp; assert(g + c + p == 1); mint ans = (g + c).pow(n) + (g + p).pow(n) + (c + p).pow(n) - 2 * (g.pow(n) + c.pow(n) + p.pow(n)); ans = 1 - ans; cout << ans.val() << "\n"; } }