
数论只会GCD
花雨就是花雨
最好的我还未等到~
展开
-
UAa11582--Colossal Fibonacci Numbers!(快速幂)
Discussion The i’th Fibonacci number f(i) is recursively defined in the following way: •f(0)=0 f(0) = 0 andf(1)=1f(1) = 1 • f(i+2)=f(i+1)+f(i)f(i + 2) = f(i + 1) + f(i) for every i ≥ 0原创 2017-08-04 21:11:59 · 485 阅读 · 0 评论 -
POJ1740--A New Stone Game(Nin变形)
Discussion Alice and Bob decide to play a new stone game.At the beginning of the game they pick n(1<=n<=10) piles of stones in a line. Alice and Bob move the stones in turn. At each step of the g原创 2017-07-29 11:59:40 · 558 阅读 · 0 评论 -
POJ2975--Nin(Nin博弈)
Discussion Nim is a 2-player game featuring several piles of stones. Players alternate turns, and on his/her turn, a player’s move consists of removing one or more stones from any single pile. Play e原创 2017-07-29 10:36:54 · 548 阅读 · 0 评论 -
HDU2188--选拔志愿者(巴什博弈)
Description 对于四川同胞遭受的灾难,全国人民纷纷伸出援助之手,几乎每个省市都派出了大量的救援人员,这其中包括抢险救灾的武警部队,治疗和防疫的医护人员,以及进行心理疏导的心理学专家。根据要求,我校也有一个奔赴灾区救灾的名额,由于广大师生报名踊跃,学校不得不进行选拔来决定最后的人选。经过多轮的考核,形势逐渐明朗,最后的名额将在“林队”和“徐队”之间产生。但是很巧合,2个人的简历几乎一模一原创 2017-07-29 10:07:42 · 695 阅读 · 0 评论 -
POJ1067--取石子游戏(威佐夫博弈)
Discussion 有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input 输入包含若干行,表示若干种石子的初始情况,其中每一行包含两个非原创 2017-07-29 10:02:41 · 420 阅读 · 0 评论 -
HDU1577--WisKey的眼神(扩展欧几里德)
数论......原创 2017-05-25 17:35:48 · 493 阅读 · 0 评论 -
POJ3349--Snowflake Snow Snowflakes(哈希)
Do more with lessDescription You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a原创 2017-08-23 16:47:30 · 539 阅读 · 1 评论 -
数论模板
欧几里德算法(辗转相除法)int gcd(int a, int b){ return b == 0 ? a : gcd(b, a%b);}唯一分解定理int judge(int *x){ x[2] /= gec(x[2],x[1]); for(int i = 2; i <= k; i ++) x[2] /= gcd(x[i],x[2]);}扩展欧几里原创 2017-07-31 13:07:07 · 622 阅读 · 0 评论