#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. 树莓派 离线安装 apt-get offline

    有网络的地方 sudo cp /var/cache/apt/archives/YOUR_PACK_NAME ~/swap/deb/ 没网络的地方 sudo dpkg -i ~/swap/deb/*

  2. [转]无废话SharePoint入门教程一[SharePoint概述]

    本文转自:http://www.cnblogs.com/iamlilinfeng/p/3026332.html 一.前言 听说SharePoint也有一段时间了,可一直处在门外.最近被调到ShareP ...

  3. [转]Windows Azure安全概述

    本文转自:http://blogs.msdn.com/b/azchina/archive/2011/03/06/windows_5f00_azure_5f00_security_5f00_overvi ...

  4. Repeater 的使用

    <HeaderTemplate></HeaderTemplate>  头模板——在加载开始执行一遍 <FooterTemplate></FooterTempl ...

  5. 2.3点击菜单显示div再点击就隐藏

    事件:onclick 属性:display 利用if语句实现 <!DOCTYPE html><html><head><meta charset="u ...

  6. Git ---创建和切换分支

    ······································································"天下武功,唯快不破" git分支: g ...

  7. hibernate对象状态 的小问题

    Class classA{ List a; public void setA(List a) { this.a =a; } public List getA() { return this.a; } ...

  8. Node.js——fs常用API

    文件状态 文件删除 文件信息 读取文件夹 文件的截取 创建文件夹 删除目录 文件监视,可以设置监视频率 文件重命名,可以用来剪切文件 注意 fs.open() fs.close() 这是最原始的读写方 ...

  9. Winform中ListView鼠标移动使用toolTip显示信息

    今天在做一个酒店管理系统的时候用到了ListView,突然想到是否能够当鼠标移动到某一项的时候给出具体房间的信息呢! 首先设置Listview的MouseMove事件 1.获取当前坐标的项 ListV ...

  10. Android(java)学习笔记201:JNI之helloword案例(利用NDK工具)

    1. 逻辑思路过程图: 2.下面通过一个HelloWorld案例来说明一下JNI利用NDK开发过程(步骤) 分析:我们在Win7系统下编译的C语言代码,我们知道C语言依赖操作系统,不能跨平台,所以我们 ...