Submission

Status:

PPPPPPP-PP

Subtask/Task Score:

90/100

Score: 90

User: Dormon

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

Language: c

Time: 0.002 second

Submitted On: 2025-09-19 18:15:34

#include <stdio.h>

int cc(int n){
    int res = 0;
    while (n > 0){
        n /= 10;
        res++;
    }
    return res;
}

int main()
{
    int a, b, x;
    scanf("%d %d %d", &a, &b, &x);
    int c = a * b;
    int k = cc(c);

    if (k <= x){
        printf("_\n");
        return 0;
    }

    // Remove k-x digits from the right to get the x-th digit from left
    for (int i = 1; i <= k - x; i++)
        c /= 10;

    // Now print the last digit
    printf("%d\n", c % 10);

    return 0;
}