1060. Are They Equal (25)】的更多相关文章

1060 Are They Equal (25)(25 分) If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*10^5^ with simple chopping. Now given the number of significant digits on a ma…
1060 Are They Equal (25 分)   If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0 with simple chopping. Now given the number of significant digits on a machine and tw…
1060 Are They Equal (25 分)   If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123×10​5​​ with simple chopping. Now given the number of significant digits on a mac…
1060 Are They Equal (25分) 题目 思路 定义结构体 struct fraction{ string f; int index; } 把输入的两个数先都转换为科学计数法,统一标准后再做比较,index表示指数 注意点 0或者0的各种形式 0.1, 0.01等 代码 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> #include<vect…
题目如下: If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*105 with simple chopping. Now given the number of significant digits on a machine and two float numbers…
题目意思直接,要求将两个数转为科学计数法表示,然后比较是否相同  不过有精度要求 /* test 6 3 0.00 00.00 test 3 3 0.1 0.001 0.001=0.1*10^-2 pay 前导0 不同格式的0 */ #include<iostream> #include<stdio.h> #include<string.h> using namespace std; char a[105],b[105]; struct num { char s[105…
模拟题.坑点较多. #include<iostream> #include<cstring> #include<cmath> #include<algorithm> #include<cstdio> #include<map> #include<queue> #include<string> #include<stack> #include<vector> using namespace…
又是一道字符串处理的题目... 题意:给出两个浮点数,询问它们保留n位小数的科学计数法(0.xxx*10^x)是否相等.根据是和否输出相应答案. 思路:先分别将两个浮点数转换成相应的科学计数法的格式1.point为小数点的索引,初始化为字符串的长度len2.not0位第一个非0的数字的索引,初始化为len如果not0为len,表明该浮点数为0,特殊处理,形式为0.0..0*10^0否则根据point和not0的大小,计算相应的指数.接着便是从str的not0开始,给ans赋值,共n位不包括小数点…
题意: 输入一个正整数N(<=100),接着输入两个浮点数(可能包含前导零,对于PAT已经习惯以string输入了,这点未知),在保留N位有效数字的同时判断两个数是否相等,并以科学计数法输出. trick: 测试点3含有有效数字在小数点以后的数据,此时指数应该是小数点位置减有效数字位置再加上1. AAAAAccepted code: #define HAVE_STRUCT_TIMESPEC #include<bits/stdc++.h> using namespace std; stri…
1060. Are They Equal (25) 时间限制 50 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as 0.123*105 with simple…