第一次参加个人赛
想着自己太辣稽肯定不能拿最佳新人
最后A了3题
实在是太辣稽了
A题 组合数取模 因为以为是很难的数学题就没做 我好智障...
B题 思维题 一开始太不谨慎了wa了几发...
C题 走台阶问题 因为没意识到数组初始赋值错了 一直错到比赛结束都不知道怎么回事 我好智障...
D题 简单Floyd 比赛时没读懂题意 赛后知道是Floyd实在是好气啊(捂脸痛哭)
F题 简单字符串模拟
G题 二进制 我竟然水过了
_______________________________________________________
Astonishing Combinatorial Number | ||||||
|
||||||
Description | ||||||
The combinatorial number CmnCnm in combinatorics, where it gives the number of the ways, disregarding order, the m objects can be chosen from among n objects; more formally, the number of m-element subsets (or m-combinations) of an n-element set. Now, there's a simple problem about this number: For three given number n, m and k, how many pairs of (i, j) will make the equation A.a be true. (0 <= i <= n, 0 <= j <= min(i, m)) Equation A.1: Cjimodk=0Cijmodk=0 |
||||||
Input | ||||||
There are multiple test cases. The first line of input contains an integer T, indicating the number of test cases. For each test case: |
||||||
Output | ||||||
Each test case should contain t lines. Each line has an integer indicate the answer of the problem. |
||||||
Sample Input | ||||||
2 1 2 3 3 2 5 4 5 6 7 |
||||||
Sample Output | ||||||
1 0 7 |
||||||
Hint | ||||||
In first test case, onlyC12=2C21=2 is multiple of 2. | ||||||
Source | ||||||
"尚学堂杯"哈尔滨理工大学第七届程序设计竞赛 |
思路:首先预处理(打表),然后统计方案数。
1
1 1
1 2 1
1 3 3 1
...................
#include
#include
#include
using namespace std;
int c[2005][2005];
int main()
{
int T;
int t,k;
while(~scanf("%d",&T))
while(T--)
{
scanf("%d%d",&t,&k);
memset(c,0,sizeof(c));
c[0][0]=1%k;
for(int i=1;i<2005;i++)
{
c[i][0]=1%k;
c[i][i]=1%k;
}
for(int i=1;i<2005;i++)
for(int j=1;j
Blind Father
Time Limit: 1000 MS
Memory Limit: 512000 K
Total Submit: 131(57 users)
Total Accepted: 66(54 users)
Rating:



Special Judge: No
Description