求A/B高精度值
来源:互联网 发布:哪个药店软件正品 编辑:程序博客网 时间:2024/06/05 14:59
Problem Description
计算A/B的精确值,设A、B是以一般整数输入,计算结果精确到小数点后20位(若不足20位,末尾不用补0)
Input
输入有多组数据,每组数据为两个数A和B
Output
对于每组数据输出A/B的精确值
Sample Input
24 330 6
Sample Output
4/3=1.3333333333333333333330/6=5.0
//标程:
#include<stdio.h>#include<string.h>int a[25];int main(){ //freopen("a.txt","r",stdin); int t,x,y,i,j; scanf("%d",&t); while(t--) { memset(a,0,sizeof(a)); scanf("%d%d",&x,&y); a[0]=x/y; if(x%y==0) { printf("%d/%d=%d.0\n",x,y,a[0]); continue; } printf("%d/%d=%d.",x,y,a[0]); int temp=x%y; for(i=1;i<21;) { temp=temp*10; a[i++]=temp/y; temp=temp%y; } for(i=20;i>0;i--) if(a[i]!=0) break; for(j=1;j<=i;j++) printf("%d",a[j]); printf("\n"); } return 0;}
- 求A/B高精度值
- 求A/B高精度值
- 求A/B高精度值
- 高精度求A+B
- 练习赛7.求A/B高精度值
- 【9102】&&【a102】求a/b的高精度值
- HDU 1402 A * B Problem Plus (FFT求高精度乘法)
- 1381 a*b 高精度
- 高精度大数A+B
- A+B Problem 高精度
- A + B高精度
- a+b(高精度)
- 【高精度算法】A*B
- 【高精度算法】A+B
- 高精度 A*B Problem
- 高精度 A+B Problem
- 高精度 A-B Problem
- a+b高精度
- 计算
- Ruby学习资料
- IC 逆向设计
- 黑马程序员----java面向对象05(多线程)
- 算法2013110702
- 求A/B高精度值
- 串口常用参数
- NoSql背景与历史
- ubuntu sublime2 安装
- 十八 Django 1.5.4 login_required
- 九九乘法表 的变态写法
- MFC 自定义消息实现与响应
- java学习笔记
- POJ 1469 COURSES (二分匹配) - from lanshui_Yang