結果
問題 |
No.3179 3 time mod
|
ユーザー |
![]() |
提出日時 | 2025-06-28 03:32:48 |
言語 | Go (1.23.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 662 bytes |
コンパイル時間 | 12,591 ms |
コンパイル使用メモリ | 238,476 KB |
実行使用メモリ | 7,972 KB |
最終ジャッジ日時 | 2025-06-28 03:33:02 |
合計ジャッジ時間 | 14,115 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 WA * 12 |
ソースコード
package main import . "fmt" import . "math/big" func main() { var n,p,q,r,a,b,c int64 Scan(&n,&p,&q,&r,&a,&b,&c) ans := solve(n,p,q,r,a,b,c) Println(ans) } func solve(n,p,q,r,a,b,c int64) (ans int64) { pqr := p*q*r X, Y, Z := new(Int), new(Int), new(Int) new(Int).GCD(nil, X, NewInt(p), NewInt(pqr/p)) new(Int).GCD(nil, Y, NewInt(q), NewInt(pqr/q)) new(Int).GCD(nil, Z, NewInt(r), NewInt(pqr/r)) x := X.Mul(X, NewInt(pqr/p)).Int64() * a y := Y.Mul(Y, NewInt(pqr/q)).Int64() * b z := Z.Mul(Z, NewInt(pqr/r)).Int64() * c xyz := x+y+z m := new(Int).Mod(NewInt(xyz), NewInt(pqr)).Int64() ans = n / pqr if n - ans * pqr >= m { ans++ } return }