結果

問題 No.9014 テストの合計点と平均点
ユーザー hatsukiyura
提出日時 2024-08-31 17:28:52
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 3,103 ms
コンパイル使用メモリ 250,484 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-08-31 17:28:57
合計ジャッジ時間 3,925 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using i64 = long long;


int main() {

    std::cin.tie(nullptr)->sync_with_stdio(false);

    std::cout << std::fixed << std::setprecision(1);
    std::string s;
    std::cin >> s;
    std::vector<int> a;
    std::string t;
    for (auto &x : s) {
        if (x != ',') t += x;
        else {
            a.push_back(std::stoi(t));
            t = "";
        }
    }
    a.push_back(std::stoi(t));
    std::cout << "合計点:" << (a[0] + a[1] + a[2]) << '\n';
    std::cout << "平均点:" << (a[0] + a[1] + a[2]) / 3.0 << '\n';

    return 0;
}
0