結果

問題 No.191 供託金
ユーザー Syuutaro
提出日時 2018-03-16 19:59:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 467 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 23,296 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-21 14:38:13
合計ジャッジ時間 932 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%d",&N);
      |     ~~~~~^~~~~~~~~
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d",&C[i]);
      |         ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(){
    //input
    int N;
    scanf("%d",&N);

    int C[100];
    for (int i = 0;i < N;i++){
        scanf("%d",&C[i]);
    }

    //total vote
    int vTotal = 0;
    for (int i = 0;i < N;i++){
        vTotal += C[i];
    }

    //total money to yukikoda
    int mTotal = 0;
    for (int i = 0;i < N;i++){
        if (C[i] <= 0.1*vTotal){
            mTotal += 30;
        }
    }

    //output
    printf("%d\n",mTotal);
    return 0;
}
0