long double精度

long double精度为15~18位
但是很多题里面需要自己去强行提高精度,免得后面的操作有误。
但是提高后自己的电脑跑出来的答案是错的,但是评测机跑出来是对的。
恩,骚操作。

例题,输入一个数,输出它除以23以后的数,保留八位小数。输入的数精度在15以下。

代码

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#define exp 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
using namespace std;
typedef long long LL;
int main()
{
    long double x;      //long double精度为15~18位
    scanf("%15Lf",&x);          //强制提高精度
    printf("%.8Lf",x/23);      //输出保留8位小数
    return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_41243063/article/details/86490126