結果

問題 No.191 供託金
ユーザー toto
提出日時 2025-03-27 15:18:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 359 bytes
コンパイル時間 447 ms
コンパイル使用メモリ 28,160 KB
実行使用メモリ 7,324 KB
最終ジャッジ日時 2025-03-27 15:18:15
合計ジャッジ時間 1,736 ms
ジャッジサーバーID
(参考情報)
judge2 / 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",&ballot[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(){
	// 立候補人数
	int val = 0;
	scanf("%d",&val);
	// 有効投票総数
	int sum = 0;
	// 各投票数
	int ballot[val];
	for(int i = 0;i < val;i ++){
		scanf("%d",&ballot[i]);
		sum += ballot[i];
	}
	sum /= 10;
	
	int ans = 0;
	for(int i = 0;i < val;i ++){
		if(sum >= ballot[i]){
			ans += 30;
		}
	}
	printf("%d",ans);
}
0