結果
問題 | No.666 1000000007で割るだけ |
ユーザー |
![]() |
提出日時 | 2020-03-30 21:55:26 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,834 bytes |
コンパイル時間 | 1,319 ms |
コンパイル使用メモリ | 166,448 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-23 04:25:18 |
合計ジャッジ時間 | 2,255 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 |
ソースコード
#include <bits/stdc++.h>using namespace std;constexpr int MOD = 1000000007;template<int mod> struct ModInt {int x;ModInt() : x(0) {}ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }ModInt operator-() const { return ModInt(-x); }ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }bool operator==(const ModInt &p) const { return x == p.x; }bool operator!=(const ModInt &p) const { return x != p.x; }ModInt inverse() const{int a = x, b = mod, u = 1, v = 0, t;while(b > 0) { t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); }return ModInt(u);}ModInt pow(int e){long long a = 1, p = x;while(e > 0) {if(e%2 == 0) {p = (p*p) % mod; e /= 2;}else {a = (a*p) % mod; e--;}}return ModInt(a);}friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {return os << p.x;}friend istream &operator>>(istream &is, ModInt<mod> &a) {long long x;is >> x;a = ModInt<mod>(x);return (is);}};int main() {ModInt<MOD> a, b;cin >> a >> b;ModInt<MOD> ans = a * b;cout << ans << endl;return 0;}