結果
問題 | No.398 ハーフパイプ(2) |
ユーザー | 6v8 |
提出日時 | 2016-07-16 00:09:55 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 46 ms / 2,000 ms |
コード長 | 2,079 bytes |
コンパイル時間 | 816 ms |
コンパイル使用メモリ | 91,256 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 14:35:41 |
合計ジャッジ時間 | 1,756 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 |
ソースコード
#include <sstream> //string stream 便利! #include<string> #include<iostream> #include<utility> //pair #include <vector> // 可変長配列 #include <algorithm> // swap,sort,binary_search #include <functional> // 昇順sortに使う greaterが入ってる。 sortの三番目の引数。 #include <map> //map #include<set> //set #include<queue> //キュー #include<list> //list #include<cmath> #include<cassert> #include <numeric> #include<tuple> #include<iomanip> typedef long long ll; #define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0])) using namespace std; void omajinai() { cin.tie(0); ios::sync_with_stdio(false); } long com(int n, int k ){ long ans =1; for(int i = 1; i<=n;i++) ans*=i; for(int i = 1; i<=k;i++) ans/=i; for(int i = 1; i<=n-k;i++) ans/=i; return ans; } map<char,char> m; long calc(int i, int j, int k , int l , int m , int n){ vector<int> t({i,j,k,l,m,n}); vector<int> x; int now = i; int nowcount = 1; for(int ii = 1; ii<6;ii++){ if(now == t[ii]) nowcount++; else{ x.push_back(nowcount); nowcount = 1; now = t[ii];} } x.push_back(nowcount); long ans = 1; int nn = 6; for(int tt: x){ ans *= com(nn,tt); nn-=tt; } return ans; } long count(int i, int j, int k , int l ){ long count = 0; count += calc(i,i,j,k,l,l); int left = i; int right = 100 - l; if(left!=0) count += calc(i-1,i,j,k,l,l) * left; if(right == 0) return count; count+= calc(i,i,j,k,l,l+1) * right; if(left == 0) return count; count += calc(i-1,i,j,k,l,l+1) * left * right; return count; } int main(){ double x; cin>>x; int t = x*4; ll ans = 0; for(int i = max(0,t-300); i<=t/4;i++){ t-=i; for(int j = max(i,t-200); j<= t/3;j++){ t-=j; for(int k = max(j,t-100); k<=t/2;k++){ t-=k; int u = t; if(k<=u) ans+=count(i,j,k,t); t+=k; } t+=j; } t+=i; } cout<<ans<<endl; }