Submission

Status:

P---------

Subtask/Task Score:

10/100

Score: 10

User: Zsawova

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-08 19:43:34

//
// Created by ASUS on 8/10/2026.
//

#include <iostream>
#include <cmath>

using namespace std;

int main() {

    /*

ตัวแปร

A, B เป็นจำนวนเต็มใดๆ มีค่าไม่เกิน 100,000

x เป็นลับดับหลักที่

     */

    int A, B, x; cin >> A >> B >> x;

    int ten = 10;
    int result = A*B;

    int digit = 0;
    int a = 1;
    while (result / ten >= 1) {result /= ten; digit++;}

    if (x < digit){digit = abs(x - digit);}
    if (x > digit){cout << "-"; return 0;}

    if (A*B/pow(ten,digit) > 0) {

        result = A*B;

        int C = pow(ten,digit);
        int T = result/C;
        result = result - (T*C);
        digit -= 1;

        if (result >= 10){ cout << result / pow(ten,digit);}
        else {cout << result;}

    }

    return 0;
}