Submission

Status:
PPPPPPPPPP

Score: 100

User: Spongebob

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

Language: c

Time: 0.001 second

Submitted On: 2024-10-16 19:58:15

#include <stdio.h>
#include <math.h>

int main () {
    long long int A, B, x;
    int i, loop_till;
    scanf("%lld", &A);
    scanf("%lld", &B);
    scanf("%lld", &x);
    long long int res = A*B;
    loop_till = (int) log10(res) + 1 - x;
    if (loop_till < 0) {
       printf("_");
       return 0;
    }
    
    for (i = 1; i <= loop_till; i++) {
        res = res / 10;
    }
    res = res % 10;
    printf("%lld", res);
        
    return 0;
}