为啥这样会有精度问题?
查看原帖
为啥这样会有精度问题?
36078
uhgariej楼主2023/10/22 22:08

下面这样写为啥会有精度问题?double精度不够?

#include <bits/stdc++.h>
#define ll unsigned long long
using namespace std;

ll A;
double B;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);

  cin >> A >> B;
  int b = B * 100;
  cout << A * b / 100 << "\n";
  return 0;
}
2023/10/22 22:08
加载中...