結果
問題 | No.520 プロジェクトオイラーへの招待 |
ユーザー |
|
提出日時 | 2017-06-06 11:01:25 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 41 ms / 4,000 ms |
コード長 | 2,083 bytes |
コンパイル時間 | 1,754 ms |
コンパイル使用メモリ | 168,660 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-22 11:40:49 |
合計ジャッジ時間 | 2,471 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include "bits/stdc++.h"using namespace std;#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))#define rep(i,j) FOR(i,0,j)#define each(x,y) for(auto &(x):(y))#define mp make_pair#define mt make_tuple#define all(x) (x).begin(),(x).end()#define debug(x) cout<<#x<<": "<<(x)<<endl#define smax(x,y) (x)=max((x),(y))#define smin(x,y) (x)=min((x),(y))#define MEM(x,y) memset((x),(y),sizeof (x))#define sz(x) (int)(x).size()#define pb push_backtypedef long long ll;typedef pair<int, int> pii;typedef vector<int> vi;typedef vector<ll> vll;template<int MOD>struct ModInt {ModInt() :x(0) {}ModInt(long long x) :x((int)(x<0 ? MOD + x%MOD : x%MOD)) { }ModInt& operator+=(ModInt that) {x = x + that.x;if (x >= MOD)x -= MOD;return *this;}ModInt& operator-=(ModInt that) {x -= that.x;if (x<0)x += MOD;return *this;}ModInt& operator*=(ModInt that) {x = (int)((long long)x * that.x % MOD);return *this;}ModInt operator+(ModInt that) {return ModInt(*this) += that;}ModInt operator-(ModInt that) {return ModInt(*this) -= that;}ModInt operator*(ModInt that) {return ModInt(*this) *= that;}int x;};typedef ModInt<1000000007> mint;mint f[102][102];int main(){ios::sync_with_stdio(false);cin.tie(0);for (int i = 0; i < 102; i++)for (int j = 0; j < 102; j++) {if (i >= 1 && j >= 1)f[i][j] = f[i - 1][j] + f[i][j - 1];else {f[i][j] = 1;}}int n, a, b, c;cin >> n;auto g = [](int x, int y, int z) {mint res;for (int i = 1; i <= x; ++i) {res += f[i - 1][y - 1] * f[x - i][z];}return res;};while (n--) {cin >> a >> b >> c;mint ans = g(a, b, c) + g(b, c, a) + g(c, a, b);FOR(i, 1, a + 1)FOR(j, 1, b + 1)FOR(k, 1, c + 1) {ans += f[a - i][j - 1] * f[b - j][k - 1] * f[c - k][i - 1];}cout << ans.x << endl;}}