結果

問題 No.766 金魚すくい
ユーザー kotatsugamekotatsugame
提出日時 2019-01-27 14:28:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 406 ms / 1,500 ms
コード長 573 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 71,784 KB
実行使用メモリ 4,472 KB
最終ジャッジ日時 2023-10-24 13:47:48
合計ジャッジ時間 9,089 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 6 ms
4,348 KB
testcase_14 AC 8 ms
4,348 KB
testcase_15 AC 6 ms
4,348 KB
testcase_16 AC 7 ms
4,348 KB
testcase_17 AC 8 ms
4,348 KB
testcase_18 AC 5 ms
4,348 KB
testcase_19 AC 7 ms
4,348 KB
testcase_20 AC 6 ms
4,348 KB
testcase_21 AC 6 ms
4,348 KB
testcase_22 AC 9 ms
4,348 KB
testcase_23 AC 384 ms
4,428 KB
testcase_24 AC 380 ms
4,424 KB
testcase_25 AC 403 ms
4,464 KB
testcase_26 AC 367 ms
4,396 KB
testcase_27 AC 402 ms
4,460 KB
testcase_28 AC 373 ms
4,404 KB
testcase_29 AC 376 ms
4,408 KB
testcase_30 AC 372 ms
4,404 KB
testcase_31 AC 406 ms
4,472 KB
testcase_32 AC 378 ms
4,416 KB
testcase_33 AC 329 ms
4,428 KB
testcase_34 AC 330 ms
4,432 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 385 ms
4,432 KB
testcase_38 AC 380 ms
4,428 KB
testcase_39 AC 399 ms
4,460 KB
testcase_40 AC 370 ms
4,408 KB
testcase_41 AC 373 ms
4,400 KB
testcase_42 AC 357 ms
4,368 KB
testcase_43 AC 2 ms
4,348 KB
testcase_44 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
long mod=1e9+7,v[1<<17];
int n,m,p;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
main()
{
	cin>>n>>m>>p;
	for(int i=0;i<n;i++)cin>>v[i];
	sort(v,v+n,greater<long>());
	long sumv=0,sump=0,C=1,ans=0;
	for(int k=0;k<n;k++)
	{
		long nowp=power(100-p,k)*power(p,m)%mod*C%mod*power(power(100,m+k),mod-2)%mod;
		sump=(sump+nowp)%mod;
		ans=(ans+nowp*sumv%mod)%mod;
		sumv=(sumv+v[k])%mod;
		C=C*(m+k)%mod*power(k+1,mod-2)%mod;
	}
	ans=(ans+(1-sump+mod)%mod*sumv%mod)%mod;
	cout<<ans<<endl;
}
0