結果
| 問題 | 
                            No.940 ワープ ε=ε=ε=ε=ε=│;p>д<│
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-12-05 02:24:06 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 140 ms / 5,000 ms | 
| コード長 | 2,776 bytes | 
| コンパイル時間 | 2,081 ms | 
| コンパイル使用メモリ | 172,016 KB | 
| 実行使用メモリ | 21,916 KB | 
| 最終ジャッジ日時 | 2024-12-15 05:36:41 | 
| 合計ジャッジ時間 | 4,056 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 5 | 
| other | AC * 22 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
template<i64 M>
struct modint {
  i64 a;
  constexpr modint(const i64 x = 0) noexcept: a((x % M + M) % M) {}
  constexpr i64 value() const noexcept { return a; }
  constexpr modint pow(i64 r) const noexcept {
    modint ans(1);
    modint aa = *this;
    while(r) {
      if(r & 1) {
        ans *= aa;
      }
      aa *= aa;
      r >>= 1;
    }
    return ans;
  }
  constexpr modint& operator+=(const modint r) noexcept {
    a += r.a;
    if(a >= M) a -= M;
    return *this;
  }
  constexpr modint& operator=(const i64 r) {
    a = (r % M + M) % M;
    return *this;
  }
  constexpr modint& operator-=(const modint r) noexcept {
    a -= r.a;
    if(a < 0) a += M;
    return *this;
  }
  constexpr modint& operator*=(const modint r) noexcept {
    a = a * r.a % M;
    return *this;
  }
  constexpr modint& operator/=(modint r) noexcept {
    i64 ex = M - 2;
    while(ex) {
      if(ex & 1) {
        *this *= r;
      }
      r *= r;
      ex >>= 1;
    }
    return *this;
  }
  constexpr modint operator+(const modint r) const {
    return modint(*this) += r;
  }
  constexpr modint operator-(const modint r) const {
    return modint(*this) -= r;
  }
  constexpr modint operator*(const modint r) const {
    return modint(*this) *= r;
  }
  constexpr modint operator/(const modint r) const {
    return modint(*this) /= r;
  }
};
using fp = modint<(i64)1e9 + 7>;
template<class T>
struct combination {
  vector<T> fact;
  vector<T> inv;
  combination(i64 n) : fact(n), inv(n) {
    fact[0] = T(1);
    for(i64 i = 1;i < n;i++)
      fact[i] = fact[i - 1] * T(i);
    inv[n - 1] = T(1) / fact[n - 1];
    for(i64 i = n - 1;i --> 0;)
      inv[i] = inv[i + 1] * T(i + 1);
  }
  T binom(i64 n, i64 k) const {
    if(k < 0 || n < k) return T(0);
    else return fact[n] * inv[k] * inv[n - k];
  }
   T H(i64 n, i64 k) const {
    return binom(n + k - 1, k);
  };
   T factor(i64 i) const { return fact[i]; }
};
int main() {
  i64 X, Y, Z;
  cin >> X >> Y >> Z;
  if(X == 0 && Y == 0 && Z == 0) {
    cout << 1 << endl;
    return 0;
  }
  combination<fp> com(X + Y + Z + 10);
  fp f(0);
  {
    fp bit(1);
    rep(i,0,X + Y + Z + 1) {
      f += bit;
      bit *= fp(2);
    }
  }
  fp ans(0);
  rep(j,0,X + Y + Z + 1) {
    fp coe = com.binom(j, X) * com.binom(j, Y) * com.binom(j, Z);
    if((j + X + Y + Z) & 1) coe *= -1;
    ans += coe * f;
    f = fp(-2) * f + fp(2).pow(X + Y + Z + 1) * com.binom(X + Y + Z + 1, j + 1);
  }
  cout << (ans / fp(2)).value() << endl;
}