結果
| 問題 |
No.398 ハーフパイプ(2)
|
| ユーザー |
btk
|
| 提出日時 | 2016-07-15 23:19:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 883 bytes |
| コンパイル時間 | 2,118 ms |
| コンパイル使用メモリ | 178,076 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-27 14:34:20 |
| 合計ジャッジ時間 | 2,996 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
string ans[]={"00","25","50","75"};
string calc(int sum){
return to_string(sum/4)+"."+ans[sum%4];
}
typedef long long LL;
const LL all=2*3*4*5*6;
int k[]={1,1,2,6,24,120,720};
LL f(vector<int> num){
LL res=all;
map<int,int> cnt;
for(auto&it:num)cnt[it]++;
for(auto &it:cnt)res/=k[it.second];
return res;
}
int main(){
LL res=0;
string X;cin>>X;
int sum=0;
for(;calc(sum)!=X&&sum<=400;sum++);
if(sum==401){
cout<<0<<endl;
}
else{
for(int a=0;a<=100;a++)
for(int b=a;b<=100;b++)
for(int c=b;c<=sum-a-b-c;c++) {
int d=sum-a-b-c;
if(d>100)continue;
if(a>0&&d<100)res+=f({0,a,b,c,d,100})*a*(100-d);
if(a>0)res+=f({0,a,b,c,d,d})*a;
if(d<100)res+=f({a,a,b,c,d,100})*(100-d);
res+=f({a,a,b,c,d,d});
}
}
cout<<res<<endl;
return 0;
}
btk