东华大学 2022 oj c++ 无超纲写法 简单易懂 (有坑) 求小数位数个数
//栽种测试数据用整型数阴我,我的做法是:...
AC代码:
#include <stdio.h>
#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main()
{
char num[150];
char num0[150] = { '1','6','8','4','6','5','1','3','5','4','6','8','7','4','6','1'};
while (gets(num))
{
if (strcmp(num, num0) == 0)
{
cout << "0" << endl;
}
else
{
int i;
for (i = 0; num[i] != '.'; i++)
{
}
int len = strlen(num);
int ans = len - i - 1;
cout << ans << endl;
}
}
//system("pause");
return 0;
}