結果

問題 No.398 ハーフパイプ(2)
ユーザー 👑 horiesinitihoriesiniti
提出日時 2016-07-16 06:47:33
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 5 ms / 2,000 ms
コード長 768 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 53,372 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 22:07:20
合計ジャッジ時間 1,166 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 5 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 3 ms
4,380 KB
testcase_13 AC 3 ms
4,380 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 3 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<iostream>
 
long long int p(int as[6]){
	int res=720;
	int div=1;
	int c=2;
	for(int i=0;i<5;i++){
		if(as[i]!=as[i+1]){
			res/=div;
			div=1;
			c=2;
		}else{
			div*=c;
			c++;
		}
	}
	res/=div;
	return res;
}
 
int main(){
	double t;
	int n;
	scanf("%lf",&t);
	n=(int)(t*4);
	long long int ans=0;
	for(int i=0;i<=100;i++){
		int t=i;
		if(t>n)break;
		for(int j=i;j<=100;j++){
			t=i+j;
			if(t>n)break;
			for(int k=j;k<=100;k++){
				t=i+j+k;
				int l=n-t;
				if((l<k)||(100<l))continue;
				int as[6]={i,i,j,k,l,l};
				ans+=p(as);
				int bs[6]={i,i,j,k,l,l+1};	
				ans+=p(bs)*(100-l);
				int cs[6]={i-1,i,j,k,l,l};
				ans+=p(cs)*i;
				int ds[6]={i-1,i,j,k,l,l+1};
				ans+=p(ds)*i*(100-l);
			}
		}
	}
	std::cout<<ans<<"\n";
}
0