結果
問題 | No.1680 Sum and Difference |
ユーザー |
|
提出日時 | 2021-09-17 21:36:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 1,160 bytes |
コンパイル時間 | 4,688 ms |
コンパイル使用メモリ | 249,648 KB |
最終ジャッジ日時 | 2025-01-24 14:39:47 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
ソースコード
//#define _GLIBCXX_DEBUG #include <bits/stdc++.h> #include <iostream> #include <algorithm> #include <atcoder/all> using namespace std; using namespace atcoder; using mint = modint1000000007; using ll = long long; using pii = pair<int,int>; using pll = pair<ll,ll>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vb = vector<bool>; using vvb = vector<vb>; using vm = vector<mint>; using vvm = vector<vm>; using vpi = vector<pii>; using vvpi = vector<vpi>; using vpl = vector<pll>; using vvpl = vector<vpl>; const int inf = 1 << 30; const ll INF = 1LL << 60; #define rep(i,m,n) for (int i = m; i < (int)(n); i++) #define rrep(i,m,n) for (int i = m; i > (int)(n); i--) int main(){ ll a,b; cin >> a >> b; mint ans = 1; if ((a-b)%2 == 0){ mint ju1 = 1, ju2 = 1; ju1 *= a+1; ju1 *= b+1; ju2 *= a; ju2 *= b; ans = ju1+ju2; cout << ans.val() << endl; } else{ mint ju1 = 1, ju2 = 1; ju1 *= a; ju1 *= b+1; ju2 *= a+1; ju2 *= b; ans = ju1+ju2; cout << ans.val() << endl; } }