結果

問題 No.191 供託金
ユーザー alchemin
提出日時 2019-09-13 14:30:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 479 bytes
コンパイル時間 574 ms
コンパイル使用メモリ 70,272 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 03:47:46
合計ジャッジ時間 1,437 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:28:13: warning: 'r' may be used uninitialized [-Wmaybe-uninitialized]
   28 |     cout << r << endl;
      |             ^
main.cpp:21:9: note: 'r' was declared here
   21 |     int r;
      |         ^

ソースコード

diff #

#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main() {
    int n;
    vector<int> v;
    
    cin >> n;
    
    int tmp;
    for (int i = 0; i < n; i++) {
        cin >> tmp;
        v.push_back(tmp);
    }
    
    double total = accumulate(v.begin(), v.end(), 0);
    
    int r;
    for (int i = 0; i < n; i++) {
        if (v[i] / total <= 0.1) {
            r += 30;    
        }
    }
    
    cout << r << endl;
    
    return 0;
}
0