Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: polikanta

Problemset: เลขหลักของผลคูณ

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-12 19:08:45

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

int main()
{
    int a;
    int b;
    int x;
    cin >> a;
    cin >> b;
    cin >> x;
    int ans = a*b;
    int t = ans;
    int c = 0;
    if (t == 0){
        c = 1;
    }
    else{
        while(t > 0){
            t = t/10;
            c++;
        }
    }
    if (x > 0 && x  <= c){
        int cut = c - x;
        int d = 1;
        for(int i = 0; i < cut;i++){
            d = d * 10;
        }
        cout << (ans / d) % 10 << endl;
    }
    else{
        cout << "_" << endl;
    }
    return 0;
}