数学
Nothing_227
Nothing is impossible!
展开
-
三角形的内点
计蒜客的一道题在一个平面坐标系中,我们可以选出三个不全在一条线上的点构成一个三角形。我们称一个在三角形内(不包含三角形的边上),横纵坐标皆为整数的点位这个三角形的内点。 对于一个由(0,0)、(n,m)、(p,0)作为顶点构成的三角形,请你设计程序求出他的内点数。输入包括一行,包括三个用空格分隔的整数,分别为n,m,p(0 ≤ n < 32000,0 < m < 3200...原创 2018-07-10 10:40:22 · 1696 阅读 · 5 评论 -
Pairs Forming LCM(素因子分解)
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=109329#problem/B 题意:在a,b中(a,b<=n)(1 ≤ n ≤ 1014),有多少组(a,b) (a<b)满足lcm(a,b)==n; 先来看个知识点:素因子分解:n = p1 ^ e1 * p2 ^ e2 *..........*pn...转载 2018-09-28 22:54:45 · 199 阅读 · 0 评论 -
费马小定理应用
要求(A/B)%9973,但由于A很大,我们只给出n(n=A%9973)(我们给定的A必能被B整除,且gcd(B,9973) = 1)。Input数据的第一行是一个T,表示有T组数据。 每组数据有两个数n(0 <= n < 9973)和B(1 <= B <= 10^9)。Output对应每组数据输出(A/B)%9973。Sample Input2...原创 2018-09-27 15:21:31 · 719 阅读 · 0 评论 -
大数同余应用
大数同余的简单介绍Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a...原创 2018-09-27 15:16:17 · 250 阅读 · 0 评论 -
求n^k得前三位和后三位(Leading and Trailing)
You are given two integers: n and k, your task is to find the most significant three digits, and least significant three digits of nk.InputInput starts with an integer T (≤ 1000), denoting the num...原创 2018-09-21 16:50:48 · 349 阅读 · 1 评论 -
青蛙的约会(扩展欧几里德定理)
扩展欧几里得定理对于不完全为 0 的非负整数 a,b,gcd(a,b)表示 a,b 的最大公约数,必然存在整数对 x,y ,使得 gcd(a,b)=ax+by。求解 x,y的方法的理解设 a>b。1,显然当 b=0,gcd(a,b)=a。此时 x=1,y=0;2,a>b>0 时设 ax1+ by1= gcd(a,b);bx2+ (a mod b)y...原创 2018-10-02 11:02:10 · 194 阅读 · 0 评论 -
Trailing Zeroes (III) (二分)
You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. For example, 5! = 120, 120 contains one zero on the tra...原创 2018-09-18 18:52:51 · 161 阅读 · 0 评论 -
矩阵快速幂入门
矩阵快速幂是通过一个状态去求出他下一个状态;矩阵乘法的基础知识:矩阵快速幂主要涉及的知识点: 乘法结合律: (AB)C=A(BC).矩阵的乘法规则:矩阵快速幂的模板(我自己常用的):struct Matrix{ int M[N][N];}A;Matrix Mul(Matrix a,Matrix b,int NN){//矩阵相乘 int i,j,k; M...原创 2018-07-31 11:57:16 · 289 阅读 · 0 评论 -
Harmonic Number ______自然数倒数和
1+1/2+1/3+1/4+……+1/n 这个调和级数还没有正确的求解公式。但是当n很大的时候有个近似的公式:1+1/2+1/3+1/4+1/5+...+1/n ≈ γ+ln(n)+1/(2*n)γ是欧拉常数,γ=0.57721566490153286060651209... ln(n)是n的自然对数(即以e为底的对数,e=2.71828...)(在c语言中,ln(n)用log...原创 2018-07-21 10:05:48 · 830 阅读 · 1 评论 -
数论_Goldbach`s Conjecture
Goldbach's conjecture is one of the oldest unsolved problems in number theory and in all of mathematics. It states:Every even integer, greater than 2, can be expressed as the sum of two primes [1]....原创 2018-07-20 15:31:55 · 272 阅读 · 0 评论 -
已知四边形四条边求四边形最大面积
有四根木棍,长度分别为 a b c d ,求着四根木棍组成四边形的最大面积。输入格式第一行包含一个整数 Ca ( Ca ≤ 10000 ) ,表示有 Ca 组测试数据,对于每组测试数据:输入包含一行,该行包含四个整数 a b c d ( 1 ≤ a , b , c , d ≤ 1000 ) 。输出格式对于每组测试数据,输出 "Case c: ans" ,其中 c 表示测试数据编...原创 2018-07-13 15:02:03 · 11047 阅读 · 0 评论 -
判断两线段相交
You can Solve a Geometry Problem too HDU - 1086 Many geometry(几何)problems were designed in the ACM/ICPC. And now, I also prepare a geometry problem for this final exam. According to the exper...原创 2018-06-05 19:48:02 · 265 阅读 · 0 评论 -
数学基本模板和基本操作方法
不断更新!!!!!!!!!!!!!每次太麻烦了素数打表int prime[maxn],ans = 0; // prime表 bool vis[maxn];//1-maxn 是否为素数 void sushudabiao(){ vis[1] = true; for(int i = 2; i < maxn;i++) if(vis[i] == false) { pr...原创 2018-07-23 11:38:44 · 235 阅读 · 0 评论 -
最大公约数_水题
Given the N integers, you have to find the maximum GCD (greatest common divisor) of every possible pair of these integers. InputThe first line of input is an integer N (1 < N < 100) that deter...原创 2018-07-23 10:37:44 · 278 阅读 · 0 评论 -
求平方根
你会求平方根么,现在请你编写一个程序,输入正整数 XX,输出它的平方根。### 输入格式输入一个正整数 XX。### 输出格式输出 XX 的平方根,答案保留三位小数。样例输入4样例输出2.000#include <bits/stdc++.h>using namespace std;const double s = 1e-4;double ...原创 2018-07-17 11:03:21 · 752 阅读 · 0 评论 -
Mysterious Bacteria (唯一分解定律)
Dr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactly x days. Now RC-01 produces exactly p new deadly Bacteria where x = ...原创 2018-09-29 21:29:10 · 225 阅读 · 0 评论