#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的更多相关文章

  1. 牛客网小白月赛5I区间(差分数组)

    链接:https://www.nowcoder.com/acm/contest/135/I来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 32768K,其他语言65536 ...

  2. 牛客网-小白月赛6-J-洋灰三角

    题目链接https://www.nowcoder.com/acm/contest/136/J 这题我还是不找规律了,老老实实推吧,传说找规律也可以,我还是算了 递推式:f(n)=k*f(n-1)+p ...

  3. 牛客网小白月赛6C(DFS,思维)

    #include<bits/stdc++.h>using namespace std;vector<int>tree[1000010];int sum=0;int dfs(in ...

  4. 牛客网小白月赛6H(最小生成树【克鲁斯卡尔】)

    #include<bits/stdc++.h>using namespace std;long long sum=0;struct node{    int a,b,len;}road[5 ...

  5. 牛客网 小白赛4 A三角形【贪心】

    [前驱]:在指定长度的棍子中找到能组成最大周长三角形的三根棍子 链接:https://www.nowcoder.com/acm/contest/134/A 来源:牛客网 题目描述 铁子从森林里收集了n ...

  6. 牛客网 牛客小白月赛12 B.华华教月月做数学-A^B mod P-快速幂+快速乘

    链接:https://ac.nowcoder.com/acm/contest/392/B来源:牛客网 华华教月月做数学 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其 ...

  7. 牛客网 牛客小白月赛1 J.おみやげをまらいました

    J.おみやげをまらいました   链接:https://www.nowcoder.com/acm/contest/85/J来源:牛客网     随便写写.   代码: 1 #include<ios ...

  8. 牛客网 牛客小白月赛1 I.あなたの蛙が帰っています-卡特兰数,组合数阶乘逆元快速幂

    I.あなたの蛙が帰っています   链接:https://www.nowcoder.com/acm/contest/85/I来源:牛客网     这个题有点意思,是卡特兰数,自行百度就可以.卡特兰数用处 ...

  9. 牛客网 牛客小白月赛1 H.写真がとどいています

    H.写真がとどいています   链接:https://www.nowcoder.com/acm/contest/85/H来源:牛客网     这个题数乱了,导致wa了好几次. 特别弱智,从A开始往上,就 ...

随机推荐

  1. [BZOJ1085][SCOI2005]骑士精神 搜索

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1085 大的思路是迭代加深搜索,我们加一个明显的剪枝,当棋盘中位置不对的骑士的数目加上已经走 ...

  2. esp8266 串口通讯

    1.发送 调用uart_init(115200,115200);初始化串口,波特率设置为115200.前面一个是设置uart0的波特率.后面一个是设置.uart的波特率 然后就可以使用uart0_tx ...

  3. js面向对象之构造函数

    最简单的面向对象程序<script type="text/javascript"> var obj = new Object(); obj.qq = '10791611 ...

  4. H1B工作签证·绿卡:美国留学的两个关键步骤

    月20日在留美学生家长群聚会上的发言稿一.H1B签证系美国最主要的工作签证类别,发放给美国公司雇佣的外国籍有专业技能的员工,属于非移民签证的一种.持有H1B签证者可以在美国工作三年,然后可以再延长三年 ...

  5. C/C++ new/delete []、内存泄漏、动态数组

    一.概念 new/delete是用于动态分配和撤销内存的运算符.new/delete是c++里才有的,c中是用malloc和free,c++虽然也可以用,但是不建议用.当我们使用关键字new在堆上动态 ...

  6. (转)SpringMVC学习(十一)——SpringMVC实现Resultful服务

    http://blog.csdn.net/yerenyuan_pku/article/details/72514034 Restful就是一个资源定位及资源操作的风格,不是标准也不是协议,只是一种风格 ...

  7. sqlalchemy ORM进阶- 批量插入数据

    参考: https://www.jb51.net/article/49789.htm https://blog.csdn.net/littlely_ll/article/details/8270687 ...

  8. vue脚手架引入swiper

    方法一: 下载swiper: npm install swiper --save-dev swiper4.0使用入口:http://www.swiper.com.cn/usage/index.html ...

  9. redis新特性

    摘自<redis 4.xcookbook> 从实例重启同步] 故障切换同步] 4.0之前从实例主键过期bug redis4新特性 Memory Command Lazy Free PSYN ...

  10. Perl字符集就是方括号(或称中括号)里一连串可能的字符,只匹配单一字符,该单一字符可以是字符集里的任何一个,“-”在字符集里有特殊含义:表示某个范围的字符。而字符集意外的连字符不具有特殊意义。

    Perl字符集就是方括号(或称中括号)里一连串可能的字符,只匹配单一字符,该单一字符可以是字符集里的任何一个,“-”在字符集里有特殊含义:表示某个范围的字符.而字符集意外的连字符不具有特殊意义.