// 356K 16MS G++// 356K 0MS G++ add m ==0 check#include #include #include int m;int n;void getNum(unsigned int n, unsigned int m) { // long long total = n; m = m < (n -m) ? m :
原创
2023-05-23 15:53:31
57阅读
// n 个 数 取 k个数的取法// C(n,k) 注意些细节#include #include #include#include #include #include #include #include using namespace std;#define LL long longLL C(int n,int k){ LL m=1; if(k>n/2) k=n-k; // 不加这句会超时 比如C[10^9][10^9 - 1] int i; for(i=1;i<=k;i++) { m*=(n-i+1); m/=i; } r...
原创
2021-07-29 16:19:15
97阅读
要做这道题首先要懂排列组合。其中如果m>n/2,可以把m=n-m。因为Cm(上
原创
2022-08-05 10:34:26
45阅读
目录POJ - 2249 Binomial ShowdownCSU 1134: Non-Decreasing DigitsPOJ - 2249 Binomial Showdown题目:In how many ways can yo
原创
2021-12-27 10:16:20
130阅读
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 21165
Accepted: 6491
Description
In how many ways can ...
原创
2023-02-08 07:28:45
68阅读
Binomial Showdown Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 18457 Accepted: 5633 Description In how many ways can you choose k elemen
转载
2017-05-12 17:30:00
127阅读
2评论
注意其计算的时候要保证边计算边减少其计算的数字不能超过long long的范围。#include#include#include #include#include#include#include#include#includeusing namespace std; long long gcd(long long big,long long small){
原创
2023-07-27 18:42:41
32阅读
ZOJ 1938 Binomial &&poj 2249 (Binomial Showdown )
原创
2022-07-29 16:20:27
22阅读
/* * POJ_2249.cpp * * Created on: 2013年10月8日 * Author: Administrator */#include #include using names
原创
2013-10-08 16:03:35
53阅读
/* * POJ_2249.cpp * * Created on: 2013年10月8日 * Author: Administrator */#include #include 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 i; for(i = 1 ; i <= k ; ++i){ a *= n-i+1; b *= i; if(a%b == 0){ a /= b...
转载
2013-10-08 22:34:00
110阅读
2评论
King Mercer is the king of ACM kingdom. There are one capiRecently, he planned to construct roads between the capi...
原创
2023-05-18 14:18:39
71阅读
#include<bits/stdc++.h>using namespace std;int main() { long long n,m; int num; scanf("%lld%lld",&n,&m); int a[n+1]; for(inta[i]);
原创
2022-11-07 14:35:55
38阅读
【题目大意】 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2249 【题目大意】 一张无向图,建造每条道路需要的费用已经给出, 现在求在起点到每个点都是最短路的情况下的最小修路费用 【题解】 考虑到最后的图一定是树形的,因此只要保
转载
2016-11-22 20:06:00
101阅读
2评论
题目传送门 #include <bits/stdc++.h> using namespace std; int n, m, k; const int N = 1e6 + 10; int a[N]; bool check(int mid) { return a[mid] >= k; } int mai
原创
2021-08-11 09:37:34
93阅读
文章目录前言一、二分查找的分析图二、附上例题三、使用步骤1.引入库2.读入数据前言一、二分查找的分析图二、附上例题传送门点这里!!!!!!三、使用步骤1.引入库代码如下(示例):
原创
2022-05-16 11:55:22
494阅读
题目描述 出题是一件痛苦的事情! 相同的题目看多了也会有审美疲劳,于是我舍弃了大家所熟悉的 A+B Problem,改用 A-B 了哈哈! 好吧,题目是这样的:给出一串数以及一个数字 CC,要求计算出所有 A - B = CA−B=C 的数对的个数(不同位置的数字一样的数对算不同的数对)。 输入格式 ...
转载
2021-09-28 21:19:00
420阅读
2评论
http://poj.org/problem?id=1222http://poj.org/problem?id=1830http://poj.org/problem?id=1681http://poj.org/problem?id=1753http://poj.org/problem?id=3185这几个题目都类似,都可以使用高斯消元来求解一个模2的01方程组来解决。有时候需要枚举自由变元,有的是判断存不存在解POJ 1222EXTENDED LIGHTS OUT普通的问题。肯定有唯一解。肯定枚举第一行去做,也可以使用高斯消元。 1 /* **************************.
转载
2013-08-17 22:12:00
153阅读
2评论
Common SubsequenceTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 34477Accepted: 13631DescriptionA subsequence of a gi
原创
2022-03-04 17:37:50
136阅读
刷了这两道枚举的题。用的都是bfs。1753这道题用到二进制的压缩方法。不管我感觉不压缩也不会超时什么的。其次的方法就是中规中矩的bfs。2965中。除了bfs,换
原创
2022-08-05 16:00:15
61阅读
这里介绍怎么求k短路
A*搜索 估价函数f[i]=g[i]+h[i];
在这里g[i]表示到达点i当前路径长,h[i]表示点i到达终点的最短距离
在搜索中,每次都取队列估价函数值最小的点,然后把它所能到达的点更新进入队列
显然这需要一个优先队列来维护(heap)
当终点第k次出队时,当前路径长度就是k短路
1 const max=1000000000;
2 type link=^nod
转载
2014-03-02 11:02:00
137阅读
2评论