等级之题N2&N1(8.3)题解

发布于 2020-08-03  0 次阅读


等级之题N2(8.3)

思路:

AC Code:

#include<cmath>
#include<cstdio>
#include<iostream>
const double pi = acos(-1.0);
using namespace std;
int main(){
    double s;
    cin>>s;
    printf("%.3lf\n", 2*sqrt(s/pi));
    return 0;
}

等级之题 N1(8.3)

思路:

AC Code:

#include<cstdio>
#include<iostream>
using namespace std;
// #define TDS_ACM_LOCAL
#define ll long long 
const int mod=1e9+7;
ll n, m, k, a, b;
ll quick_pow(ll a, ll b)
{ 
	ll res = 1;
	while (b)
	{
		if (b & 1)
			res = res * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return res;
}

void solve(){
    cin>>n>>m>>k>>a>>b;
    ll x=(((((b*n)%mod -(a*n)%mod -(a*m)%mod)+mod)%mod *quick_pow(n+m, k))%mod +((a*(n+m)%mod)%mod *quick_pow(n+m+1, k))%mod)%mod;
    ll y=(b*quick_pow(n+m+1, k))%mod;
    y=quick_pow(y,mod-2);
    cout<<x*y%mod<<endl;
    return ;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
#ifdef TDS_ACM_LOCAL
    freopen("D:\\VS code\\.vscode\\testall\\in.txt", "r", stdin);
    freopen("D:\\VS code\\.vscode\\testall\\out.txt", "w", stdout);
#endif
    solve();
    return 0;
}

平平无奇的大学在读本科生