Submission

Status:

PPP-PPPPPP

Subtask/Task Score:

90/100

Score: 90

User: Pera

Problemset: เส้นทางคณิตศาสตร์

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-03 17:38:35

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int x, y, z; cin >> x >> y >> z;

    switch (z)
    {
    case 1:
        cout << x + y << '\n';
        break;
    case 2:
        cout << x - y << '\n';
        break;
    case 3:
        cout << x * y << '\n';
        break;
    case 4:
        if (y == 0) {
            cout << "cannot divide by zero" << '\n';
            break;
        }
        cout << static_cast<double>(x) / y << '\n';
        break;
    case 5:
        if (y == 0) {
            cout << "cannot divide by zero" << '\n';
            break;
        }
        cout << x % y << '\n';
        break;
    default:
        break;
    }
}