求助,最后一个过不了
查看原帖
求助,最后一个过不了
1249045
yi_ye_qing_zhou楼主2024/1/15 23:22
#include<iostream>
#include<cmath>
using namespace std;
int main() {
    int a, b, n, answer;
    cin >> a >> b >> n;
    double temp = a*1.0 / b;
    temp-=int(temp);
    for (int i = 0; i < n-1; i++) {
        temp = temp * 10 - int(temp * 10);
    }
    answer = int(temp * 10);
    cout << answer;
    return 0;
}
2024/1/15 23:22
加载中...