• 牛客网小白月赛1 B,I


     1 #include <stdio.h>
     2 #include <math.h>
     3 #include <string.h>
     4 #include <stdlib.h>
     5 #include <iostream>
     6 #include <sstream>
     7 #include <algorithm>
     8 #include <string>
     9 #include <queue>
    10 #include <map>
    11 #include <vector>
    12 #include <iomanip>
    13 using namespace std;
    14 const int maxn = 1e3+50;
    15 const int maxm = 1e4+10;
    16 const int inf = 0x3f3f3f3f;
    17 const double epx = 1e-10;
    18 typedef long long ll;
    19 const ll INF = 1e18;
    20 const double pi = acos(-1.0);
    21 int main()
    22 {
    23     int t,c;
    24     double a,b;
    25     cin>>t;
    26     while(t--)
    27     {
    28         cin>>a>>b>>c;
    29         cout<<setiosflags(ios::fixed)<<setprecision(c)<<(double)pow(a,exp(1))/b<<endl;//控制输出小数点后位数
    30     }
    31 }

    I题  卡特兰数 出栈序列有多少种

     1 #include <stdio.h>
     2 #include <math.h>
     3 #include <string.h>
     4 #include <stdlib.h>
     5 #include <iostream>
     6 #include <sstream>
     7 #include <algorithm>
     8 #include <string>
     9 #include <queue>
    10 #include <map>
    11 #include <vector>
    12 #include <iomanip>
    13 #define mem(a,b) memset(a,b,sizeof(a))
    14 using namespace std;
    15 const int maxn = 5e5+50;
    16 const int inf = 0x3f3f3f3f;
    17 const double epx = 1e-10;
    18 const double pi = acos(-1.0);
    19 typedef long long ll;
    20 const ll INF = 1e18;
    21 const ll mod = 998244353;
    22 ll n,f[maxn];
    23 void ff()
    24 {
    25     f[0]=1;
    26     for(int i=1;i<=500000;i++)
    27         f[i]=(i*f[i-1])%mod;
    28 }
    29 ll poww(ll n,ll m)
    30 {
    31     ll ans = 1;
    32     while(m > 0)
    33     {
    34         if(m & 1)ans = (ans * n) % mod;
    35         m = m >> 1;
    36         n = (n * n) % mod;
    37     }
    38     return ans;
    39 }
    40 ll cc(ll n,ll m)
    41 {
    42     ll ans=f[n];
    43     ans=(ans*poww(f[m],mod-2))%mod;
    44     ans=(ans*poww(f[n-m],mod-2))%mod;
    45     return ans;
    46 }
    47 int main()
    48 {
    49     int t,kase=1;
    50     cin>>t;
    51     ff();
    52     //cout<<cc(6,3)<<endl;
    53     while(t--)
    54     {
    55         cin>>n;
    56         int m=n-1;
    57         ll ans1=(cc(2*n,n)-cc(2*n,n+1))%mod;
    58         ll ans2=(cc(2*m,m)-cc(2*m,m+1))%mod;
    59         //cout<<ans1<<" "<<ans2<<endl;
    60         printf("Case #%d: %lld
    ",kase++,(ans1-ans2+2*mod)%mod);
    61     }
    62 }
    View Code
  • 相关阅读:
    html5中新增的form表单属性
    FORM
    .Net Core 发布失败
    Sql Server查询最近执行sql
    HttpWebRequest.GetResponse()操作超时
    使用SqlBulkCopy批量插入/更新数据
    ADO .NET 往数据库批量插入数据发生错误:超时时间已到,但是尚未从池中获取链接
    Ueditor代码内容前台只显示一行
    Lambda表达式
    委托的简单使用
  • 原文地址:https://www.cnblogs.com/stranger-/p/8597978.html
Copyright © 2020-2023  润新知