且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

NEFU 461 递推式转通项公式

更新时间:2022-04-05 14:03:47

网址:http://acm.nefu.edu.cn/test/problemshow.php

NEFU 461 递推式转通项公式

#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;

int main()
{
    double a,b,u,v;
    int n;
    while(~scanf("%d%lf%lf%lf%lf",&n,&a,&b,&u,&v))
        printf("%d\n",(int)(log10(1/sqrt(u*u+4*v))+(double)n*log10((u+sqrt(u*u+4*v))/2)+log10(b-a*((u-sqrt(u*u+4*v))/2))+1));
    return 0;
}