Submission

Status:

PP--PPPP-P

Subtask/Task Score:

70/100

Score: 70

User: pupu

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-11-27 19:12:29

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(){ios::sync_with_stdio(0);cin.tie(0);
    long long int a,b,x,sum,c=0;
    cin>>a>>b>>x;
    sum = a*b;
    while(sum>0){
        sum/=10;
        c++;
    }
    sum = (a*b) /(pow(10,((c-x))));
    if (a*b==0 && x==0){
        cout<<0;
        return 0;
    }
    if(sum < 1){
        cout<<"_";
        return 0;
    }
    else{
        cout << sum % 10;
        return 0;
    }
}