結果
| 問題 |
No.398 ハーフパイプ(2)
|
| コンテスト | |
| ユーザー |
T1610
|
| 提出日時 | 2020-08-24 00:20:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 18 ms / 2,000 ms |
| コード長 | 2,702 bytes |
| コンパイル時間 | 2,907 ms |
| コンパイル使用メモリ | 203,856 KB |
| 最終ジャッジ日時 | 2025-01-13 13:02:48 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}
// #define DEBUG_MODE
#ifdef DEBUG_MODE
#define dump(x) cout << #x << " : " << x << " "
#define dumpL(x) cout << #x << " : " << x << '\n'
#define LINE cout << "line : " << __LINE__ << " "
#define LINEL cout << "line : " << __LINE__ << '\n'
#define dumpV(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << " "
#define dumpVL(v) cout << #v << " : ["; for(auto& t : v) cout << t << ", "; cout<<"]" << endl
#define STOP assert(false)
#else
#define dump(x)
#define dumpL(x)
#define LINE
#define LINEL
#define dumpV(v)
#define dumpVL(v)
#define STOP assert(false)
#endif
int main(){
string s;
cin >> s;
int sum = 0;
for(auto&& c: s) if(c != '.') {
sum *= 10;
sum += c - '0';
}
vi f(7);
f[1] = 1;
REP(i, 2, f.size()) f[i] = f[i-1] * i;
sum *= 4;
sum /= 100;
ll ans = 0;
rep(i0, 101) REP(i1, i0, 101) REP(i2, i1, 101) {
int i3 = sum - (i0 + i1 + i2);
if(i3 < i2 || i3 > 100) continue;
vi v{i0, i1, i2, i3};
dumpVL(v);
map<int, int> mp;
for(auto&& x: v) mp[x]++;
//zenbutigau
if(i0 > 0 && i3 < 100) {
ll tmp = i0 * (100 - i3);
tmp *= f[6];
for(auto&& p: mp) tmp /= f[p.second];
ans += tmp;
dump(tmp);
}
// i3 dake issho
if(i0 > 0) {
ll tmp = i0;
tmp *= f[6];
mp[i3]++;
for(auto&& p: mp) tmp /= f[p.second];
mp[i3]--;
ans += tmp;
dump(tmp);
}
// i0 dake issho
if(i3 < 100) {
ll tmp = 100-i3;
tmp *= f[6];
mp[i0]++;
for(auto&& p: mp) tmp /= f[p.second];
mp[i0]--;
ans += tmp;
dump(tmp);
}
//i0 to i3
{
ll tmp = 1;
tmp *= f[6];
mp[i0]++;
mp[i3]++;
for(auto&& p: mp) tmp /= f[p.second];
mp[i0]--;
mp[i3]--;
ans += tmp;
dumpL(tmp);
}
}
cout << ans << '\n';
return 0;
}
T1610