![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
1710orange
凝听万物之音
展开
-
hdu 3549 Flow Problem(最大流增广路入门模板题)
转载于:https://blog.csdn.net/freezhanacmore/article/details/9365605 题目:http://acm.hdu.edu.cn/showproblem.php?pid=3549Flow Probl...转载 2018-08-29 17:13:59 · 161 阅读 · 0 评论 -
HDU Let the Balloon Rise 1004(重复出现最多的字符)
原题地址:http://acm.hdu.edu.cn/showproblem.php?pid=1004#include <iostream>#include <cstdio>using namespace std;int N,ans,sum;struct colors{ int no; int x; string c;};colors color[1...原创 2018-08-28 16:49:15 · 121 阅读 · 0 评论 -
HDU - 2108 Shape of HDU (坐标叉乘判断正负)
话说上回讲到海东集团推选老总的事情,最终的结果是XHD以微弱优势当选,从此以后,“徐队”的称呼逐渐被“徐总”所取代,海东集团(HDU)也算是名副其实了。 创业是需要地盘的,HDU向钱江肉丝高新技术开发区申请一块用地,很快得到了批复,据说这是因为他们公司研发的“海东牌”老鼠药科技含量很高,预期将占全球一半以上的市场。政府划拨的这块用地是一个多边形,为了描述它,我们用逆时针方向的顶点序列来表示,我...原创 2018-08-14 15:16:16 · 1140 阅读 · 0 评论 -
HDU - 2036 改革春风吹满地 (多边形面积,三角形叉积得面积)
“ 改革春风吹满地, 不会AC没关系; 实在不行回老家, 还有一亩三分地。 谢谢!(乐队奏乐)” 话说部分学生心态极好,每天就知道游戏,这次考试如此简单的题目,也是云里雾里,而且,还竟然来这么几句打油诗。 好呀,老师的责任就是帮你解决问题,既然想种田,那就分你一块。 这块田位于浙江省温州市苍南县灵溪镇林家铺子村,多边形形状的一块地,原本是linle 的,现在就准备送给你...原创 2018-08-14 09:39:29 · 106 阅读 · 0 评论 -
HDU - 1078 FatMouse and Cheese(背包dp问题)
FatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is labelled (p,q) where 0 <= p < n and 0 <= q < n. At each grid lo...原创 2018-08-16 14:41:42 · 219 阅读 · 0 评论 -
C - Cow Picnic POJ - 3256(vector)
牛野餐 http://poj.org/problem?id=3256时间限制: 2000MS 内存限制: 65536K 提交总数: 5945 接受: 2452 描述奶牛正在野餐!每个农民约翰的ķ(1≤ ķ ≤100)奶牛放牧是在一个ñ(1≤ ñ ≤1000)牧场,方便编号为1 ... ñ。草场由连接中号(1≤ 中号 ≤10,000)单向路径...转载 2018-08-06 10:34:55 · 163 阅读 · 0 评论 -
HDU - 5101 Select(单调性)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5101思路:利用单调性求出总的符合要求的对数ans,再求出班级里符合的对数sum,两者相剪;代码如下:#include <iostream>#include <cstdio>#include <algorithm>typedef long long...转载 2018-08-22 15:51:45 · 118 阅读 · 0 评论 -
欧拉函数及其证明
草稿转载 2018-08-06 18:52:56 · 297 阅读 · 0 评论 -
【算法】欧拉函数——小于n的数中与n互质数的数目
转载于BoilTask的博客:https://blog.csdn.net/u011493189/article/details/50985170 欧拉函数简介 在数论,对正整数n,欧拉函数是小于n的数中与n互质的数的数目。此函数以其首名研究者欧拉命名(Ruler’so totient function...转载 2018-08-06 20:08:25 · 293 阅读 · 0 评论 -
HDU 1166 敌兵布阵(线段树)
这个是线段树中最入门的题目,但是由于不了解线段树的概念,当然更不知道怎么样,所以觉得挺费劲,整了一会发现还是基本的思想,就是还是将一个线段继续分割,一直分割到不能分割,这道题目是知道多少个军营,也就是区间为1-n, 将它分割, 建立树, 可以不用保存它区间的左端点和右端点,用数组下标代表就可以了, 数组的值代表当前军营里人的个数,然后这个题就是单个点的增加或者减少,其实增加减少都是增加,减少只是把...转载 2018-09-22 16:22:50 · 132 阅读 · 0 评论 -
HDU 1003 Max Sum (dp)
转载于:https://blog.csdn.net/dgq8211/article/details/7737451题目链接:Click here~~题意:RT。解题思路:比较简单的dp,很容易推出状态转移方程:sum[i] = max{sum[i-1]+a[i],a[i]}. (sum[i]记录以a[i]为子序列末端的最大连续和.)然后用一个值记录更新sum[i]的最大值即...转载 2018-08-28 16:24:16 · 113 阅读 · 0 评论 -
POJ - 1064 Cable master(二分法无限逼近)
大致思路为先自定义left,right的值,然后使用二分法得到mid,测试mid是大于要求的值还是小于要求的值,然后最终使left 与right无限逼近答案。#include <cstdio>#include <cmath>using namespace std;const double inf = 200005;double num[10005];int N...原创 2018-08-20 11:34:14 · 278 阅读 · 2 评论 -
HDU - 1086 You can Solve a Geometry Problem too(坐标差乘)
Problem Description Many geometry(几何)problems were designed in the ACM/ICPC. And now, I also prepare a geometry problem for this final exam. According to the experience of many ACMers, geometry probl...原创 2018-08-13 11:15:41 · 135 阅读 · 0 评论 -
Problem - 3936 FIB Query(斐波那契恒等式 矩阵乘法 快速幂运算乘法)
转载于:https://blog.csdn.net/henuyh/article/details/81517227 题目链接Problem DescriptionWe all know the definition of Fibonacci series: fib[i]=fib[i-1]+fib[i-2],fib...转载 2018-08-10 19:50:20 · 132 阅读 · 0 评论 -
NOIP 冲刺:常见的递推之卡特兰数
转载于:https://blog.csdn.net/zhn_666/article/details/78216372 例题: 在一个凸n边形中,通过不相交于n边形内部的对角线,把n边形拆分成若干三角形,问有多少种拆分方案。啊啊啊啊 卡特兰数 卡特兰数又称卡塔兰数,卡特兰数是组合数学中一个常出现在各种计数问题中...转载 2018-08-10 11:39:09 · 251 阅读 · 0 评论 -
POJ:Relatives(欧拉函数直接求法)
DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x &amp;amp;amp;gt; 1, y &amp;amp;amp;gt; 0, z &amp;amp;am原创 2018-08-07 10:04:02 · 132 阅读 · 0 评论 -
POJ - 3070 Fibonacci (矩阵快速幂运算)
In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. For example, the first ten terms of the Fibonacci sequence are:0, 1, 1, 2, 3, 5, 8, 13, 21, 34, …An alternati...原创 2018-08-11 17:33:08 · 269 阅读 · 0 评论 -
POJ - 2478 Farey Sequence(欧拉筛选法)
Description 链接:http://poj.org/problem?id=2478The Farey Sequence Fn for any integer n with n &amp;gt;= 2 is the set of irreducible rational numbers a/b with 0 &amp;lt; a &amp;lt; b &amp;lt;= n and gcd(a,b) = 1 arra...原创 2018-08-07 16:23:32 · 133 阅读 · 0 评论 -
欧拉函数筛选算法
直接法:是用(P是数N的质因数) 筛选法: 首先看算法:long long a[1000020]; memset(a,0,sizeof(a)); a[1]=1; for(int i=2; i&amp;amp;lt;1000020; i++) if(!a[i]) for(int j=i; j&amp;amp;lt;1000020; j+=i) { ...原创 2018-08-07 16:53:45 · 886 阅读 · 0 评论 -
LightOJ - 1370 Bi-shoe and Phi-shoe(素数筛选法)
Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe to go...原创 2018-08-07 20:57:09 · 122 阅读 · 0 评论 -
UVA - 11426 GCD - Extreme (II)(欧拉函数筛选法+欧拉函数”倍数关系“)
原题地址: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2421给定N的值,您必须找到G的值.G的定义如下:这里GCD(i,j)表示整数i和整数j的最大公约数。 对于那些无法理解求和符号的人,G的含义在 以下代码:...原创 2018-08-08 11:33:16 · 241 阅读 · 0 评论