题目大意:从字符串中读取信息,然后根据公式计算
解题思路:从字符串中提取信息,并保存和标记,然后在根据公式进行计算
#include<cstdio>
#include<cmath>
#include<cstring>
double find_n(char *str, int i) {
int count = 0;
double recode[20];
double times = 1;
double ren_n = 0;
int number = 0;
int mark = 0;
double sign = 1;
int start = 2;
if(str[i+2] == '-') {
sign = -1;
start++;
}
for(int j = i + start; ; j++) {
if(str[j] >= '0' && str[j] <= '9') {
recode[count] = str[j] - '0';
count++;
if(mark == 1)
number--;
}
if(str[j] == '.')
{
mark = 1;
continue;
}
if(str[j] == 'k') {
times = 1000;
break;
}
if(str[j] == 'M') {
times = 1000000;
break;
}
if(str[j] == 'm