码迷,mamicode.com
首页 > 其他好文 > 详细

模板:求A/B高精度值

时间:2018-07-19 21:26:51      阅读:452      评论:0      收藏:0      [点我收藏+]

标签:main   i++   std   cst   style   namespace   iostream   class   str   

http://lfyzit.com/problem/42

#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
int a, b, x[21];               
    cin>>a>>b;
    printf("%d/%d=%d.", a, b, a/b); 
    for(int i=1; i<=20; i++){      
        a%=b;
        a*=10;
        x[i]=a/b;
    }
    int i=20;
    while(x[i]==0 && i>1) i--;     
    for(int j=1; j<=i; j++)         
        printf("%d", x[j]);
    return 0;
}

 

模板:求A/B高精度值

标签:main   i++   std   cst   style   namespace   iostream   class   str   

原文地址:https://www.cnblogs.com/Aze-qwq/p/9337792.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!