POJ 3175 枚举

思路:
枚举小数点前 的数是啥 判一判 复杂度是根号的…..

注意精度!!!!

//By SiriusRen
#include <cmath>
#include <cstdio>
using namespace std;
#define LL long long
int n,l;
int main(){
    scanf("%d%d",&n,&l);
    double base=pow(0.1,n),dsc=base*l;
    for(int i=1;;i++){
        double a=dsc+i,s=(LL)(a*a+1),e=(a+base)*(a+base);
        if(e>s+1e-11){printf("%lld
",(LL)s);return 0;}
    }
}

这里写图片描述

原文地址:https://www.cnblogs.com/SiriusRen/p/6532195.html