省赛来了

时间限制:1000 ms  |  内存限制:65535 KB
难度:2
描写叙述

一年一度的河南省程序设计大赛又要来了。

竞赛是要组队的,组队形式:三人为一队,设队长一名。队员两名。

如今问题就来了,给你m个人,要求每队n个人。求共同拥有几种不同的组队方式。

(题目保证m%n等于0,全部数据不超出int范围)

输入
多组測试数据,以EOF结束。

每组測试数据输入两个整数m,n。
输出
对每组測试数据输出不同组队方式的数量(考虑到输出的数可能会非常大,所以请输出对2013取余后的值)。并在输出结束之后输入一个换行符。

例子输入
4 2
例子输出
6
组合问题!
AC码:
#include<stdio.h>
int C(int m,int n)
{
int cm=1,cn=1,i;
for(i=2;i<=n;i++)
cn*=i;
for(i=m-n+1;i<=m;i++)
cm*=i;
return cm/cn;
}
int main()
{
int m,n;
while(~scanf("%d%d",&m,&n))
{
int res=1;
while((m/n)>1)
{
res=res*C(m,n)%2013;
m-=n;
}
printf("%d\n",res);
}
return 0;
}

NYOJ 158 省赛来了的更多相关文章

  1. NYOJ 1272 表达式求值 第九届省赛 (字符串处理)

    title: 表达式求值 第九届省赛 nyoj 1272 tags: [栈,数据结构] 题目链接 描述 假设表达式定义为: 1. 一个十进制的正整数 X 是一个表达式. 2. 如果 X 和 Y 是 表 ...

  2. [河南省ACM省赛-第三届] 房间安排 (nyoj 168)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168 分析:找到一天中需要最多的房间即可 #include<iostream> ...

  3. [河南省ACM省赛-第三届] AMAZING AUCTION (nyoj 251)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=251 规则: 1.若某竞标价唯一,则胜出 2.若不存在唯一竞标价,则投标次数最少竞标价中标 ...

  4. [河南省ACM省赛-第三届] 网络的可靠性 (nyoj 170)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170 根据题意,需要找到度数为1的结点个数,如下图: #include<iostre ...

  5. [河南省ACM省赛-第三届] BUYING FEED (nyoj 248)

    #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> us ...

  6. [河南省ACM省赛-第三届] 素数 (nyoj 169)

    #include <iostream> #include <cstdio> #include <queue> #include <cstring> #i ...

  7. [河南省ACM省赛-第三届] 聪明的kk (nyoj 171)

    题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=171 动态规划: d(i,j) = max{d(i-1, j), d(i, j-1)}+m ...

  8. [河南省ACM省赛-第四届] 序号互换 (nyoj 303)

    相似与27进制的转换 #include<iostream> #include<cstdio> #include<cstring> #include<strin ...

  9. [河南省ACM省赛-第四届] 表达式求值(nyoj 305)

    栈的模拟应用: #include<iostream> #include<cstdio> #include<cstring> #include<string&g ...

随机推荐

  1. mongdb数据库的操作

    一.数据库使用 1.使用mongodb服务,必须先开启服务,开启服务使用 mongod --dbpath D:mongdb    (D:mongdb  自己所创建数据库的路径, 在cmd窗口中输入) ...

  2. Android开发中JavaBean类和序列化知识的理解

    原创文章,转载请注明出处:http://www.cnblogs.com/baipengzhan/p/6296121.html Android开发中,我们经常用到JavaBean类以及序列化的知识,但经 ...

  3. phpize Cannot find autoconf. 错误解决

    phpize Configuring for: PHP Api Version: 20151012 Zend Module Api No: 20151012 Zend Extension Api No ...

  4. 第二章:C++简单程序设计

    主要内容: 1.C++语言概述 2.基本数据类型和表达式 3.数据的输入与输出 4.算法的基本控制结构 5.自定义数据类型 1.数据类型default is double 2.自定义数据类型就是bui ...

  5. 使用scrapy爬取suning

    # -*- coding: utf-8 -*- import scrapy from copy import deepcopy class SuSpider(scrapy.Spider): name ...

  6. C语言学习12

    希尔排序 //希尔排序 #include <stdio.h> void main() { ], i; int shell(int a[], int n); printf("请输入 ...

  7. LeetCode(12)Integer to Roman

    题目 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from ...

  8. LeetCode 309. Best Time to Buy and Sell Stock with Cooldown (stock problem)

    Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...

  9. [第一波模拟\day2\T1] {病毒分裂}(split.cpp)

    [题目描述] A 学校的实验室新研制出了一种十分厉害的病毒.由于这种病毒太难以人工制造了,所以专家们在一开始只做出了一个这样的病毒.这个病毒被植入了特殊的微型芯片,使其可以具有一些可编程的特殊性能.最 ...

  10. ES6(Iterator 和 for...of 循环)

    Iterator 和 for...of 循环 1.什么是 Iterator 接口 Iterator 接口功能:用一种相同办法的接口让不同的数据结构得到统一的读取命令的方式 2.Iterator的基本用 ...