![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数论
Jin_Dybala
这个作者很懒,什么都没留下…
展开
-
(计蒜客)三角形的内点
题目:在一个平面坐标系中,我们可以选出三个不全在一条线上的点构成一个三角形。我们称一个在三角形内(不包含三角形的边上),横纵坐标皆为整数的点位这个三角形的内点。 对于一个由(0,0)、(n,m)、(p,0)作为顶点构成的三角形,请你设计程序求出他的内点数。输入包括一行,包括三个用空格分隔的整数,分别为n,m,p(0 ≤ n < 32000,0 < m < 32000,0 <...原创 2018-05-26 17:08:21 · 433 阅读 · 0 评论 -
HDU-3579 Hello Kiki 线性同余方程的运用
题目:One day I was shopping in the supermarket. There was a cashier counting coins seriously when a little kid running and singing "门前大桥下游过一群鸭,快来快来 数一数,二四六七八". And then the cashier put the counted coi...原创 2018-08-28 00:08:38 · 297 阅读 · 1 评论 -
HDU_5015 233 Matrix 矩阵快速幂
这是我矩阵快速幂入门的最后一练,从了解矩阵快速幂,到现在应用,其实矩阵快速幂可以分为两点,一点是矩阵的相乘,另外一点就是快速幂的掌握,所以并不需要把矩阵快速幂的代码实现想象的很困难。但是这并不是说矩阵快速幂的应用不难,通过这题,可以感受到,矩阵快速幂的应用,重点是要找到递推关系,然后将状态转移矩阵构建出来,这个是最关键的。初始矩阵不同,所构建的状态转移矩阵肯定也会不同。In our daily...原创 2018-08-04 18:14:14 · 272 阅读 · 0 评论 -
HDU_2276 矩阵快速幂与二进制的结合
There are n lights in a circle numbered from 1 to n. The left of light 1 is light n, and the left of light k (1< k<= n) is the light k-1.At time of 0, some of them turn on, and others turn off. ...原创 2018-08-04 17:36:37 · 190 阅读 · 0 评论 -
POJ_3233 Matrix Power Series【矩阵递推方法】和 【二分+矩阵快速幂方法】
Given a n × n matrix A and a positive integer k, find the sum S = A + A2 + A3+ … + Ak.InputThe input contains exactly one test case. The first line of input contains three positive integers n (n ≤...原创 2018-08-03 19:44:37 · 176 阅读 · 0 评论 -
POJ_3070 矩阵快速幂实现斐波那契数列变化
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-03 18:48:22 · 217 阅读 · 0 评论 -
Choosing Ice Cream
You are standing in the supermarket in front of the freezers. You have a very tough task ahead of you: you have to choose what type of ice cream you want for after dinner that evening. After a while, ...原创 2018-07-20 16:47:02 · 190 阅读 · 0 评论 -
nefu120-梅森素数(Lucas-Lehmer判定法和Miller测试法)
准备知识:梅森素数:它是发现已知最大素数的有效途径。如果m是一个正整数,且是一个素数,则m必是素数。反之,如果m是一个正整数、素数,且2^m-1称作第m个梅森数;如果p是一个素数,并且也是素数,那么就称为梅森素数。而梅森数可能是素数,也可能是合数。(由于很多word公式无法导入,只能以截图方式展现。)Lucas-Lehmer判定法#include <iostream>using n...原创 2018-05-28 20:38:10 · 697 阅读 · 0 评论 -
nefu118-计算N!末尾0的个数
准备知识:1.(算术基本定理)任何大于1的正整数n都可以表示成素数之积,即素数是整数的乘法构成单位。每个大于1的正整数n都可以被唯一地写成素数的乘积,在乘积中的素因子按照非降序排列。正整数n的分界式 n=(p1^a1)*(p2^a2)*......*(pk^ak)称为n的标准分解式,其中p1,p2...原创 2018-05-27 16:26:45 · 639 阅读 · 0 评论 -
青蛙的约会 POJ-1061 (扩展欧几里得算法解同余方程)
两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,...原创 2018-08-25 11:44:15 · 406 阅读 · 0 评论