結果

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

ソースコード

diff #

#include<stdio.h>
int main()
{
	// 出馬人数
	int val;
	scanf("%d", &val);
	// 各々の投票数
	int num[val];
	// 有効投票総数
	int total = 0;
	for (int i = 0; i < val; i++){
		scanf("%d", &num[i]);
		total += num[i];
	}
	// 供託金返還の票数を上回れなかった人数
	int count = 0;
	for (int i = 0; i < val; i++){
		if (num[i] * 10 <= total){
			count++;
		}
	}
	// 1人につき30万円
	printf("%d\n", count * 30);
	return 0;
}
0