結果

問題 No.191 供託金
ユーザー sasa
提出日時 2025-03-13 16:26:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 27,904 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-13 16:26:38
合計ジャッジ時間 1,427 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 21 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d",&val);
      |         ~~~~~^~~~~~~~~~~
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%d",&num[i]);
      |                 ~~~~~^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	// 入力された出馬人数
	int val = 0;
	// 各々の票数
	scanf("%d",&val);
	int num[val];
	// 投票総数
	int total = 0;
	// 出馬人数分ループ・投票数の総数を算出
	for(int i = 0;i < val;i++){
		scanf("%d",&num[i]);
		total += num[i];
	}
	// 供託金返還の基準投票数
	int effective = total / 10;
	// 基準投票数を上回っていない人数
	int count = 0;
	for(int i = 0;i < val;i++){
		if(effective > num[i]){
			count++;
		}
	}
	// 1人につき30万円
	printf("%d",count * 30);
}
0