
数学
mowayao
这个作者很懒,什么都没留下…
展开
-
uva11889 Benefit
思路与uva10892类似#include #include #include using namespace std;long long gcd(long long a,long long b){ return b == 0 ?a : gcd(b,a%b);}int main(){ int ncase; vector num; cin >> ncase; while(n原创 2013-08-04 22:46:25 · 683 阅读 · 0 评论 -
POJ2405-Beavergnaw
BeavergnawTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6204 Accepted: 4090DescriptionWhen chomping a tree the beaver cuts a very specific shape out o原创 2014-06-20 15:14:38 · 1509 阅读 · 0 评论 -
HDU4099-Revenge of Fibonacci(trie树+数学基础)
Revenge of FibonacciTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 204800/204800 K (Java/Others)Total Submission(s): 1944 Accepted Submission(s): 446Problem DescriptionThe wel原创 2014-06-20 17:48:00 · 864 阅读 · 0 评论 -
HDU3988-Harry Potter and the Hide Story(数论-质因数分解)
Harry Potter and the Hide StoryTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2193 Accepted Submission(s): 530Problem Descripti原创 2014-07-29 23:25:06 · 808 阅读 · 1 评论 -
HDU4038-Stone(思维题)
StoneTime Limit: 3000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)Total Submission(s): 2267 Accepted Submission(s): 568Problem DescriptionGiven an array of int原创 2014-08-18 17:48:23 · 742 阅读 · 0 评论 -
POJ1408-Fishnet(线段求交)
FishnetTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 1788 Accepted: 1144DescriptionA fisherman named Etadokah awoke in a very small island. He could s原创 2014-08-20 20:54:02 · 862 阅读 · 0 评论 -
POJ1228-Grandpa's Estate(凸包)
Grandpa's EstateTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10851 Accepted: 2953DescriptionBeing the only living descendant of his grandfather, Kamr原创 2014-08-20 20:52:59 · 1167 阅读 · 0 评论 -
HDU4675-GCD of Sequence(数论+组合计数)
GCD of SequenceTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 949 Accepted Submission(s): 284Problem DescriptionAlice is pla原创 2014-08-08 16:23:22 · 941 阅读 · 0 评论 -
POJ1584-A Round Peg in a Ground Hole(凸包,判圆在凸包内)
A Round Peg in a Ground HoleTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 5301 Accepted: 1662DescriptionThe DIY Furniture company specializes in assem原创 2014-08-20 21:01:00 · 948 阅读 · 0 评论 -
POJ3525-Most Distant Point from the Sea(二分+半平面交)
Most Distant Point from the SeaTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 3955 Accepted: 1847 Special JudgeDescriptionThe main land of Japan ca原创 2014-08-20 21:06:23 · 999 阅读 · 0 评论 -
HDU3944-DP?(帕斯卡公式+Lucas定理)
DP?Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 128000/128000 K (Java/Others)Total Submission(s): 1930 Accepted Submission(s): 640Problem DescriptionFigure 1 shows t原创 2014-08-11 15:46:23 · 1474 阅读 · 0 评论 -
HDU 5017 Ellipsoid(模拟退火)
EllipsoidTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1015 Accepted Submission(s): 359Special JudgeProblem DescriptionGive原创 2014-09-23 15:12:34 · 831 阅读 · 0 评论 -
HDU 5027 Help!(三分+圆与线段的交点)
Help!Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 180 Accepted Submission(s): 32Problem Description“Help! Help!”While原创 2014-09-23 14:12:18 · 1319 阅读 · 0 评论 -
HDU 5033 Building(类凸包+向量叉积的应用)
HDU 5033 类凸包原创 2014-09-24 15:54:58 · 854 阅读 · 0 评论 -
HDU 5047 Sawtooth(有趣的思维题+证明)
SawtoothTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 979 Accepted Submission(s): 375Problem DescriptionThink about a plane原创 2014-09-29 13:41:22 · 1304 阅读 · 0 评论 -
UVa 12716 GCD XOR (简单证明)
题意: 问 gcd(i,j) = i ^ j 的对数(j 思路:容易想到 形如 (2,3) (4,5).....这种互质相邻且二进制位数相同的数一定满足要求。那么对于gcd为2情况进行分析:从gcd(a,b) = 2得到a/2,b/2互质,可以想到a/2与b/2相差只能是1,因为要使a^b = 2 a,b只有在第1位有差别,即差别为2,如果a/2与b/2相差超过1,那么a,b就不原创 2014-10-15 14:19:28 · 1299 阅读 · 0 评论 -
HDU1796-How many integers can you find
How many integers can you findTime Limit: 12000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3867 Accepted Submission(s): 1088Problem Descripti原创 2014-07-28 23:23:10 · 747 阅读 · 0 评论 -
GCD最大公约数递归定理的证明
定理如下:对任意非负整数a和任意正整数b, gcd(a,b) = gcd(b,a mod b)首先证明 gcd(a,b) | gcd(b,a mod b)设 gcd(a,b) = da mod b = a - b*k (k = a/b 向下取整的整数)易得 d | a mod b 和 d | b 得出 d | gcd(b,a mod b) (d 为 最大公约数的一个因数)接原创 2014-05-25 11:23:16 · 2204 阅读 · 0 评论 -
UVa-10104-Euclid Problem
The ProblemFrom Euclid it is known that for any positive integers A and B there exist such integers X and Y that AX+BY=D, where D is the greatest common divisor of A and B. The problem is to find原创 2014-05-25 13:31:17 · 724 阅读 · 0 评论 -
Uva10892 LCM Cardinality
基础的数论题:对n进行因式分解,因为两个数的LCM一定是LCM的因数。根据公式a*b = lcm(a,b)*gcd(a,b) 判断a,b是否为所求。#include #include #include #include using namespace std;int gcd(int a,int b){ return b == 0 ? a : gcd(b,a%b);}int main原创 2013-08-04 16:14:00 · 752 阅读 · 0 评论 -
Uva10780 Again Prime? No Time.
这题搞了1个多小时= =!靠着UVA的BBS上的数据才过的 思路是:把m质因数分解,各质因数的系数用map(a)记录,把1到n的数都质因数分解,用map(b)记录(累加),然后逐一遍历,碰到a[i]=0则跳过,碰到b[i] = 0& a[i]!= 0 则无解,接下来就是我无法理解地方了,判断前两种情况之后,如果碰到b[i] 无法整除a[i] 的时候,理应是无解,但是我只要这样判 就是WA,如果不判原创 2013-08-05 22:14:17 · 749 阅读 · 0 评论 -
Uva11752 The Super Powers
简单的数论题:主要的注意点是计算幂的时候尽量少用pow,精度损失太大。#include #include #include #include #include #include #include #include using namespace std;const int maxn = 100 + 10;bool vis[maxn];map mm;vectorans;vo原创 2013-08-06 22:24:46 · 719 阅读 · 0 评论 -
Uva11609 teams
主要是公式的推导和快速幂的使用,弹了一次,因为交大出的那本SCL快速幂的模板有点小错误#include #include #include using namespace std;long long pow_mod(long long a,long long i,long long n){ if(i == 0) return 1%n; long long tmp = pow_m原创 2013-08-07 20:42:13 · 702 阅读 · 0 评论 -
Uva11489 Integer Game
#include #include #include #include using namespace std;int main(){ int ncase,T=1; cin >> ncase; string num; while(ncase--){ cin >> num; int sum = 0; int a=0,b=0,c=0; bool flag = 0;原创 2013-08-07 22:51:03 · 651 阅读 · 0 评论 -
Uva11461 Square Numbers
水题:upper_bound,lower_bound解决问题#include #include #include #include #include using namespace std;int main(){ int a,b; vector squ; vector::iterator low,up; for(int i = 1; i <= 1000; i++){原创 2013-08-07 23:15:40 · 585 阅读 · 0 评论 -
LA2756--Crazy tea party
规律题:被n=2的这种情况坑了!#include #include #include using namespace std;int main(){ vector dd; dd.push_back(0); dd.push_back(0); dd.push_back(1); for(int i = 2; i <= 17000; i++){ int tmp = ((i+1)*原创 2013-08-08 16:28:58 · 657 阅读 · 0 评论 -
Uva11076-Add Again
简单的排列组合题:英语差一开始在纠结这个digit的意思,后来知道digit是一位数的意思,做法很简单,就是统计每个数的个数,用map记录,如1112,1的个数是3,2的个数是1。z最后计算的时候除去个数的阶乘即可。#include #include #include #include #include #include using namespace std;#define ULL原创 2013-08-10 12:37:42 · 753 阅读 · 0 评论 -
SGU497Abelian Groups
Andrew has just made a breakthrough in group theory: he realized that he can classify all finite Abelian groups (not much of a breakthrough, indeed). Given n, how many Abelian groups with n elements原创 2013-11-07 21:18:28 · 631 阅读 · 0 评论 -
ZOJ3216Compositions
We consider problems concerning the number of ways in which a number can be written as a sum. If the order of the terms in the sum is taken into account the sum is called a composition and the numbe原创 2013-11-10 10:47:53 · 774 阅读 · 0 评论 -
矩阵 快速幂
出处http://www.cnblogs.com/yan-boy/archive/2012/11/29/2795294.html矩阵的快速幂是用来高效地计算矩阵的高次方的。将朴素的o(n)的时间复杂度,降到log(n)。这里先对原理(主要运用了矩阵乘法的结合律)做下简单形象的介绍:一般一个矩阵的n次方,我们会通过连乘n-1次来得到它的n次幂。但做下简单的改进就能转载 2013-11-10 11:24:55 · 587 阅读 · 0 评论 -
Uva10288Coupons
CouponsInput: standard inputOutput: standard outputTime Limit: 2 secondsMemory Limit: 32 MB Coupons in cereal boxes are numbered 1 to n, and a set of one of each is required for a prize (a原创 2013-11-29 19:04:44 · 1070 阅读 · 0 评论 -
UVa11582 - Colossal Fibonacci Numbers!
Problem F: Colossal Fibonacci Numbers!The i'th Fibonacci number f (i) is recursively defined in the following way:f (0) = 0 and f (1) = 1f (i+2) = f (i+1) + f (i) for every i ≥ 0Your task i原创 2014-03-19 11:40:57 · 1182 阅读 · 0 评论 -
UVa10689 - Yet another Number Sequence
Problem BYet another Number SequenceInput: standard inputOutput: standard outputTime Limit: 3 secondsLet's define another number sequence, given by the following function:f(0) = af(1原创 2014-03-20 00:02:20 · 1270 阅读 · 0 评论 -
UVa11489 - Integer Game
IInteger Game Two players, S and T, are playing a game where they make alternate moves. S plays first. In this game, they start with an integer N. In each move, a player remov原创 2014-03-23 12:14:31 · 853 阅读 · 0 评论 -
UVa10236 - The Fibonacci Primes
Problem AThe Fibonacci PrimesInput: standard inputOutput: standard outputTime Limit: 8 secondsMemory Limit: 32 MB The Fibonacci number sequence is 1, 1, 2, 3, 5, 8, 13 and so on. You原创 2014-03-23 15:14:57 · 788 阅读 · 0 评论 -
UVa 12683 Odd and Even Zeroes(数论+数位DP)
UVa 12683 Odd and Even Zeroes(数论+数位DP)原创 2014-10-19 17:37:42 · 1334 阅读 · 0 评论