Binomial Showdown Time Limit: 2 Seconds      Memory Limit: 65536 KB In how many ways can you choose k elements out of n elements, not taking order into account? Write a program to compute this number. Input The input will contain one or more test cas…
水题三题: 1.给你B和N,求个整数A使得A^n最接近B 2. 输出第N个能被3或者5整除的数 3.给你整数n和k,让你求组合数c(n,k) 1.poj 3100 (zoj 2818) Root of the Problem: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2818 http://poj.org/problem?id=3100 #include<cstdio> #include<cmath>…
Binomial Showdown TimeLimit: 1 Second   MemoryLimit: 32 Megabyte Totalsubmit: 2323   Accepted: 572 Description In how many ways can you choose k elements out of n elements, not taking order into account? Write a program to compute this number. Input…
题意:求使得C(n,k)=m的所有的n,k 根据杨辉三角可以看出,当k固定时,C(n,k)是相对于n递增的:当n固定且k<=n/2时,C(n,k)是相对于k递增的,因此可以枚举其中的一个,然后二分另一个. 我的方法是先预处理出2000以内的全部组合数,然后枚举n,二分找到对应的k<=n/2,然后把(n,k)和(n,n-k)加入到set中. 但这样做有一个缺陷,就是当k太小的时候,n可能会很大,数组存不下,因此当k比较小的时候,应该单独枚举k然后二分找到n. k=1的时候不用算,直接加入即可.…
// n 个 数 取 k个数的取法// C(n,k) 注意些细节#include <iostream> #include <string> #include<sstream> #include <cmath> #include <map> #include <stdio.h> #include <string.h> #include <algorithm> using namespace std; #defin…
/* * POJ_2249.cpp * * Created on: 2013年10月8日 * Author: Administrator */ #include <iostream> #include <cstdio> using namespace std; typedef long long int64; int64 work(int64 n , int64 k){ if(k > n/2){ k = n-k; } int64 a = 1; int64 b = 1; int…
Description There are so many different religions in the world today that it is difficult to keep track of them all. You are interested in finding out how many different religions students in your university believe in. You know that there are n stud…
Description In how many ways can you choose k elements out of n elements, not taking order into account? Write a program to compute this number. Input The input will contain one or more test cases. Each test case consists of one line containing two i…
ACM大量习题题库 ACM大量习题题库 现在网上有许多题库,大多是可以在线评测,所以叫做Online Judge.除了USACO是为IOI准备外,其余几乎全部是大学的ACM竞赛题库. USACO http://ace.delos.com/usacogate 美国著名在线题库,专门为信息学竞赛选手准备 TJU http://acm.tongji.edu.cn/ 同济大学在线题库,唯一的中文题库,适合NOIP选手 ZJU http://acm.zju.edu.cn/ 浙江大学在线题库 JLU htt…
[热烈庆祝ZOJ回归] P1002:简单的DFS #include <cstdio> #include <cstring> #include <algorithm> ][]; int N; int input() { scanf("%d",&N); ;i<N;i++) scanf("%s",map[i]); return N; } ][]; ,sizeof(disable)); } int dfs(int cur)…