牛客网小白月赛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开始往上,就 ...
随机推荐
- 移动端UI自动化Appium测试——Appium server两种启动方式
执行自动化测试之前,需要先运行appium server,这样才能形成server与java client的通信,启动server有两种方式,一种是命令,一种是按钮图标,具体使用如下: 1.用命令启动 ...
- html5的表单元素总结
- linux下php访问sql server设置
安装freeIDS 官网下载地址: wget ftp://ftp.freetds.org/pub/freetds/stable/freetds-1.00.18.tar.gz 1.1.到下载目录解压 t ...
- [转载]iTOP-4418开发板Ubuntu系统烧写方法分享
本文转自迅为论坛:http://topeetboard.com 开发平台:iTOP-4418开发板系统:Ubuntu 1. TF卡读写速度测试烧写 Ubuntu 对于 TF 卡的要求比较高,很多老旧的 ...
- element-UI el-table表格根据搜索条件表格值改变颜色
Part.1 关键代码 var s = "天气"; // 需要匹配的字符 var reg = new RegExp("(" + s + ")" ...
- _bbox_pred函数
fast中的_bbox_pred函数和faster中的bbox_transform_inv是一样的,是将框进行4个坐标变换得到新的框坐标.fast中是将selective search生成的框坐标进行 ...
- 【JavaScript从入门到精通】第一课
第一课 初探JavaScript魅力-01 JavaScript是什么 如今我们打开一个大型的网站,都会有很多JS效果的功能和应用.对于学过CSS+HTML的同学,即使是像淘宝那样的网站,用一两天时间 ...
- org.mybatis.spring.transaction.SpringManagedTransaction - JDBC Connection [********] will not be managed by Spring
如下图,查看层次是否正确.
- python 删除/查找重复项
l = [1,2,3,2,1] # l = ['你','我','他','她','你'] for i in l: print("the %s has found %s" % (i, ...
- Java调用WebService接口实现发送手机短信验证码功能,java 手机验证码,WebService接口调用
近来由于项目需要,需要用到手机短信验证码的功能,其中最主要的是用到了第三方提供的短信平台接口WebService客户端接口,下面我把我在项目中用到的记录一下,以便给大家提供个思路,由于本人的文采有限, ...