zoukankan      html  css  js  c++  java
  • 【2017"百度之星"程序设计大赛

    【链接】http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=776&pid=1001


    【题意】


    在这里写题意

    【题解】


    因为列的顺序已经定了,则只要知道车在哪些行就可以了.
    最多车的个数就是min(n,m);
    答案就是C(max(n,m),min(n,m));

    【错的次数】


    0

    【反思】


    在这了写反思

    【代码】

    #include <bits/stdc++.h>
    using namespace std;
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    #define LL long long
    #define rep1(i,a,b) for (int i = a;i <= b;i++)
    #define rep2(i,a,b) for (int i = a;i >= b;i--)
    #define mp make_pair
    #define pb push_back
    #define fi first
    #define se second
    #define ms(x,y) memset(x,y,sizeof x)
    #define ri(x) scanf("%d",&x)
    #define rl(x) scanf("%lld",&x)
    #define rs(x) scanf("%s",x+1)
    #define oi(x) printf("%d",x)
    #define ol(x) printf("%lld",x)
    #define oc putchar(' ')
    #define os(x) printf(x)
    #define all(x) x.begin(),x.end()
    #define Open() freopen("F:\rush.txt","r",stdin)
    #define Close() ios::sync_with_stdio(0)
    
    
    typedef pair<int,int> pii;
    typedef pair<LL,LL> pll;
    
    
    const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
    const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
    const double pi = acos(-1.0);
    const int N = 1e3;
    const LL MOD = 1000000007;
    
    
    LL c[N+10][N+10];
    
    
    int main(){
        //Open();
        //Close();
        rep1(i,1,N)
            c[i][0] = c[i][i] = 1;
        rep1(i,2,N)
            rep1(j,1,N)
                c[i][j] = (c[i-1][j-1]+c[i-1][j])%MOD;
        int T;
        ri(T);
        while (T--){
            int n,m;
            ri(n),ri(m);
            ol(c[max(n,m)][min(n,m)]);puts("");
        }
        return 0;
    }
    


  • 相关阅读:
    nginx开机自启动
    解决This system is not registered with RHN
    数据库琐表
    linux启动和关闭防火墙命令
    linux端口开放
    linux常用命令
    dedecms编辑器不能复制word格式的处理方法
    dede5.7 标题长度限制修改
    网站收录地址大全
    最全的各搜索引擎、各免费收录提交网站入口大全
  • 原文地址:https://www.cnblogs.com/AWCXV/p/7626092.html
Copyright © 2011-2022 走看看