algo — C++23 日本語リファレンス GitHub

test/aoj/challenge/0109.test.cpp

AC · 最終更新 2026-09-06 · GitHub

問題: https://onlinejudge.u-aizu.ac.jp/problems/0109

依存するヘッダ(1)
実装
// competitive-verifier: PROBLEM https://onlinejudge.u-aizu.ac.jp/problems/0109
#include <iostream>
#include <string>
#include "parser/parser.hpp"

int main() {
    int n;
    std::cin >> n;
    while (n--) {
        std::string s;
        std::cin >> s;
        // 式は '=' で終わるので末尾を落とす
        if (!s.empty() && s.back() == '=') s.pop_back();
        std::cout << eval_expr<long long>(s) << '\n';
    }
    return 0;
}