結果

問題 No.586 ダブルブッキング
ユーザー monburan_0401monburan_0401
提出日時 2018-09-14 12:59:45
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 1,018 ms
コンパイル使用メモリ 28,268 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-18 07:53:26
合計ジャッジ時間 1,350 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 0 ms
4,376 KB
testcase_03 AC 0 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void){
	int P1,P2;							//	P1: yukiホテル料金、P2: 他のホテル料金
	int N;								//	予約数
	int r;									//	予約された部屋番号
	int R[1000] = { 0 };			//	部屋番号の予約数カウント
	int C = 0;							//	損失合計額
	
	scanf("%d %d",&P1,&P2);
	scanf("%d",&N);
	
	for(int i = 0; i < N; i++){
		scanf("%d",&r);
		R[r]++;
	}
	
	for(int j = 1; j < 1000; j++){
		if(R[j] > 1){
			C += (P1 + P2)*(R[j] - 1);
		}
	}
	
	printf("%d\n",C);
	
	return 0;
}
0