#30253: 19


810177@stu.hgsh.hc.edu.tw (810177董蒙恩)

學校 : 不指定學校
編號 : 145795
來源 : [120.104.3.13]
最後登入時間 :
2022-02-16 11:24:31
a248. 新手訓練 ~ 陣列應用 -- 新手訓練系列 ~ 2 | From: [120.104.3.13] | 發表日期 : 2022-05-11 11:47

#include <bits/stdc++.h>

using namespace std;

int main(){
    int n, x, y;
    while(cin >> x >> y >> n){
        int ans = x%y;
        cout << x/y << '.';
        for(int i = 0; i<n; i++){
            cout << ans*10/y;
            ans = ans*10%y;
        }
        cout << endl;
    }

    return 0;
}

 
ZeroJudge Forum