結果
| 問題 | No.586 ダブルブッキング | 
| コンテスト | |
| ユーザー |  suppy193 | 
| 提出日時 | 2023-09-03 15:52:31 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 344 bytes | 
| コンパイル時間 | 259 ms | 
| コンパイル使用メモリ | 20,992 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-12 21:32:49 | 
| 合計ジャッジ時間 | 882 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 | 
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%d%d%d", &p1, &p2, &n);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:16:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |                 scanf("%d", &rn);
      |                 ^~~~~~~~~~~~~~~~
            
            ソースコード
#include<stdio.h>
int main(void){
	
	int i, n;
	int p1, p2;
	int rn, r[1000];
	int c = 0;
	
	scanf("%d%d%d", &p1, &p2, &n);
	for(i = 1;i < 1000;i++){
		r[i] = 0;
	}
	for(i = 0;i < n;i++){
		scanf("%d", &rn);
		r[rn]++;
	}
	for(i = 1;i < 1000;i++){
		if(r[i] > 1){
			c += (p1 + p2) * (r[i] - 1);		
		}
	}
	
	printf("%d\n", c);
	
	return 0;
}
            
            
            
        