結果

問題 No.586 ダブルブッキング
ユーザー monburan_0401
提出日時 2018-09-14 12:59:45
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 512 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 29,568 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 23:56:26
合計ジャッジ時間 931 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

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