牛客网小白月赛1 B,I
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <vector>
#include <iomanip>
using namespace std;
const int maxn = 1e3+;
const int maxm = 1e4+;
const int inf = 0x3f3f3f3f;
const double epx = 1e-;
typedef long long ll;
const ll INF = 1e18;
const double pi = acos(-1.0);
int main()
{
int t,c;
double a,b;
cin>>t;
while(t--)
{
cin>>a>>b>>c;
cout<<setiosflags(ios::fixed)<<setprecision(c)<<(double)pow(a,exp())/b<<endl;//控制输出小数点后位数
}
}
I题 卡特兰数 出栈序列有多少种
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <vector>
#include <iomanip>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
const int maxn = 5e5+;
const int inf = 0x3f3f3f3f;
const double epx = 1e-;
const double pi = acos(-1.0);
typedef long long ll;
const ll INF = 1e18;
const ll mod = ;
ll n,f[maxn];
void ff()
{
f[]=;
for(int i=;i<=;i++)
f[i]=(i*f[i-])%mod;
}
ll poww(ll n,ll m)
{
ll ans = ;
while(m > )
{
if(m & )ans = (ans * n) % mod;
m = m >> ;
n = (n * n) % mod;
}
return ans;
}
ll cc(ll n,ll m)
{
ll ans=f[n];
ans=(ans*poww(f[m],mod-))%mod;
ans=(ans*poww(f[n-m],mod-))%mod;
return ans;
}
int main()
{
int t,kase=;
cin>>t;
ff();
//cout<<cc(6,3)<<endl;
while(t--)
{
cin>>n;
int m=n-;
ll ans1=(cc(*n,n)-cc(*n,n+))%mod;
ll ans2=(cc(*m,m)-cc(*m,m+))%mod;
//cout<<ans1<<" "<<ans2<<endl;
printf("Case #%d: %lld\n",kase++,(ans1-ans2+*mod)%mod);
}
}
牛客网小白月赛1 B,I的更多相关文章
- 牛客网小白月赛5I区间(差分数组)
链接:https://www.nowcoder.com/acm/contest/135/I来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 32768K,其他语言65536 ...
- 牛客网-小白月赛6-J-洋灰三角
题目链接https://www.nowcoder.com/acm/contest/136/J 这题我还是不找规律了,老老实实推吧,传说找规律也可以,我还是算了 递推式:f(n)=k*f(n-1)+p ...
- 牛客网小白月赛6C(DFS,思维)
#include<bits/stdc++.h>using namespace std;vector<int>tree[1000010];int sum=0;int dfs(in ...
- 牛客网小白月赛6H(最小生成树【克鲁斯卡尔】)
#include<bits/stdc++.h>using namespace std;long long sum=0;struct node{ int a,b,len;}road[5 ...
- 牛客网 小白赛4 A三角形【贪心】
[前驱]:在指定长度的棍子中找到能组成最大周长三角形的三根棍子 链接:https://www.nowcoder.com/acm/contest/134/A 来源:牛客网 题目描述 铁子从森林里收集了n ...
- 牛客网 牛客小白月赛12 B.华华教月月做数学-A^B mod P-快速幂+快速乘
链接:https://ac.nowcoder.com/acm/contest/392/B来源:牛客网 华华教月月做数学 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其 ...
- 牛客网 牛客小白月赛1 J.おみやげをまらいました
J.おみやげをまらいました 链接:https://www.nowcoder.com/acm/contest/85/J来源:牛客网 随便写写. 代码: 1 #include<ios ...
- 牛客网 牛客小白月赛1 I.あなたの蛙が帰っています-卡特兰数,组合数阶乘逆元快速幂
I.あなたの蛙が帰っています 链接:https://www.nowcoder.com/acm/contest/85/I来源:牛客网 这个题有点意思,是卡特兰数,自行百度就可以.卡特兰数用处 ...
- 牛客网 牛客小白月赛1 H.写真がとどいています
H.写真がとどいています 链接:https://www.nowcoder.com/acm/contest/85/H来源:牛客网 这个题数乱了,导致wa了好几次. 特别弱智,从A开始往上,就 ...
随机推荐
- gulp构建工具学习汇总
前端脚手架____gulp配置文件------- https://pan.baidu.com/s/1eSs7COy 1:有了package.json 直接 npm install自动下载相应的npm包 ...
- [BZOJ1009][HNOI2008]GT考试 DP+矩阵快速幂+KMP
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1009 我们令$dp(i,j)$表示已经填了$i$位,而且后缀与不幸运数字匹配了$j$位,那 ...
- 001原始编译全志r6平台tinav3.0.2系统
001原始编译全志r6平台tinav3.0.2系统 2018/6/8 11:32 版本:V1.0 开发板:R6 SDK:tina v3.0.2 1.01原始编译全志r16平台tinav3.0系统: r ...
- java 线程池第一篇 之 ThreadPoolExcutor
一:什么是线程池? java 线程池是将大量的线程集中管理的类,包括对线程的创建,资源的管理,线程生命周期的管理.当系统中存在大量的异步任务的时候就考虑使用java线程池管理所有的线程.减少系统资源的 ...
- eval()将json 字符串转换为数组
json ={ GW:[{id:"655",mc:"董事"},{id:"656",mc:"书记"},{id:" ...
- Can't find bundle for base name messages.AndroidJpsBundle, locale zh_CN
从http://www.android-studio.org/网站上下载了一个Android Studio 3.0的非安装版本(android-studio-ide-171.4408382-wind ...
- JS 中的 JSON
JSON是JavaScript Object Notation的缩写,它是一种数据交换格式. 在JSON出现之前,大家一直用XML来传递数据.因为XML是一种纯文本格式,所以它适合在网络上交换数据.X ...
- Farseer.net轻量级ORM开源框架 V1.x 入门篇:视图实体类映射
导航 目 录:Farseer.net轻量级ORM开源框架 目录 上一篇:Farseer.net轻量级ORM开源框架 V1.x 入门篇:表的数据操作 下一篇:Farseer.net轻量级ORM开源框 ...
- IE主页被恶意修改处理办法
HKEY_USERS/.DEFAULT/Software/Policies/Microsoft/Internet Explorer/Control Panel 下的DWORD值“homepage”的键 ...
- Matlab plotyy画双纵坐标图实例
Matlab plotyy画双纵坐标图实例 x = 0:0.01:20;y1 = 200*exp(-0.05*x).*sin(x);y2 = 0.8*exp(-0.5*x).*sin(10*x);[A ...