
数学
文章平均质量分 55
ctsas
这个作者很懒,什么都没留下…
展开
-
Maximum GCD [水题]
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 determines the原创 2017-02-16 14:03:58 · 956 阅读 · 0 评论 -
Gym - 100187D [逆元]
Everyone knows that the battle of Endor is just a myth fabled by George Lucas for promotion of his movie. Actually, no battle of Endor has happened and the First Galactic Empire prospers to this day.Th原创 2017-03-19 22:03:07 · 658 阅读 · 0 评论 -
[POJ] 3070 Fibonacci [矩阵快速幂]
FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14582 Accepted: 10269DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = F原创 2017-03-16 13:07:15 · 385 阅读 · 0 评论 -
地狱飞龙 [simpson][积分]
题目描述最近clover迷上了皇室战争,他抽到了一种地狱飞龙,很开心。假设地域飞龙会对距离为d的敌人每秒造成k/d2伤害。假设地域飞龙位于坐标轴原点,以每秒v1的速度向y轴正方向移动,敌人在(x,0)的位置,以每秒v2的速度向x轴负方向移动。问,敌人至少有多少血量永远才不会被地狱飞龙喷死。(伤害是连续造成的,不是一秒一秒间断的)输入第一行为数据组数T(1<=T<=1000) 每组数据一行,包含4个原创 2017-04-29 22:51:11 · 846 阅读 · 0 评论 -
[51nod] 1013 3的幂的和 [逆元][水题]
求:30+31+...+3(N)mod10000000073^0 + 3^1 +...+ 3^(N) \mod 1000000007 Input 输入一个数 N(0<=N<=109)N(0 <= N <= 10^9) Output 输出:计算结果 Input示例 3 Output示例 40题解等比数列求和即可 ans=(1−3n+1)⋅2−1mod1000000007ans=(1-原创 2017-04-20 08:46:37 · 279 阅读 · 0 评论 -
Number
题意P=p1p2p3…pnP=p_1p_2p_3…p_np1,p2,p3,…,pnp_1,p_2,p_3,…,p_n 不同给出 k ,求第n大的p输入 n,k(1<=k<=8,1<=n<=105)n,k (1<=k<=8,1<=n<=10^5)输出答案满足限制条件k下的第n大的p的数值 Sample Input Sample Output 10000 1 104327 10原创 2017-05-24 19:27:01 · 363 阅读 · 0 评论 -
[51NOD] 1265 四点共面 [数学&向量叉积]
给出三维空间上的四个点(点与点的位置均不相同),判断这4个点是否在同一个平面内(4点共线也算共面)。如果共面,输出”Yes”,否则输出”No”。 Input 第1行:一个数T,表示输入的测试数量(1 <= T <= 1000) 第2 - 4T + 1行:每行4行表示一组数据,每行3个数,x, y, z, 表示该点的位置坐标(-1000 <= x, y, z <= 1000)。 Output原创 2017-07-18 14:57:03 · 622 阅读 · 0 评论 -
[51NOD]-1264 线段相交 [计算几何&叉积&点积]
基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注 给出平面上两条线段的两个端点,判断这两条线段是否相交(有一个公共点或有部分重合认为相交)。 如果相交,输出”Yes”,否则输出”No”。 Input 第1行:一个数T,表示输入的测试数量(1 <= T <= 1000) 第2 - T + 1行:每行8个数,x1,y1,x2,y2,x3,y3,x4,y4原创 2017-07-18 18:01:04 · 374 阅读 · 0 评论 -
[HDU]6053 TrickGCD
TrickGCDURL: http://acm.hdu.edu.cn/showproblem.php?pid=6053You are given an array A , and Zhu wants to know there are how many different array B satisfy the following conditions?1≤Bi≤AiFor each pair(原创 2017-07-31 21:08:19 · 399 阅读 · 0 评论 -
[HDU] 6061 RXD and functions [NTT]
URL: http://acm.split.hdu.edu.cn/showproblem.php?pid=6061 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 702 Accepted Submission(s):原创 2017-08-07 22:40:28 · 632 阅读 · 0 评论 -
[51NOD]1244 莫比乌斯函数之和
莫比乌斯函数之和基准时间限制:3 秒 空间限制:131072 KB 分值: 320 难度:7级算法题 http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1244莫比乌斯函数,由德国数学家和天文学家莫比乌斯提出。梅滕斯(Mertens)首先使用μ(n)(miu(n))作为莫比乌斯函数的记号。具体定义如下: 如果一个数包含平方原创 2017-08-02 08:49:03 · 367 阅读 · 0 评论 -
[51NOD]1239 欧拉函数之和
欧拉函数之和基准时间限制:3 秒 空间限制:131072 KB 分值: 320 难度:7级算法题 http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1239对正整数n,欧拉函数是小于或等于n的数中与n互质的数的数目。此函数以其首名研究者欧拉命名,它又称为Euler’s totient function、φ函数、欧拉商数等。原创 2017-08-02 10:27:47 · 450 阅读 · 0 评论 -
[BZOJ]3944: Sum
DescriptionInput一共T+1行 第1行为数据组数T(T<=10) 第2~T+1行每行一个非负整数N,代表一组询问Output一共T行,每行两个用空格分隔的数ans1,ans2Sample Input6 1 2 8 13 30 2333Sample Output1 1 2 0 22 -2 58 -3 278 -3 1655470 2题解#include<stdi原创 2017-08-02 11:15:34 · 295 阅读 · 0 评论 -
[HDU]6069 Counting Divisors
URL : http://acm.hdu.edu.cn/showproblem.php?pid=6069求: (∑i=lrd(ik))mod998244353\begin{eqnarray*} \left(\sum_{i=l}^r d(i^k)\right)\bmod 998244353 \end{eqnarray*} l,r,k(1≤l≤r≤1012,r−l≤106,1≤k≤107)l,r,k原创 2017-08-03 17:44:06 · 1746 阅读 · 14 评论 -
Polya定理及应用
概念及定理首先是群的概念:设 GG 是一个集合,∗* 是 GG 上的二元运算,如果 (G,∗)(G,*) 满足下面的条件:封闭性:对于任何 a,b∈Ga,b \in G 有 a∗b∈Ga*b \in G;结合律:对任何 a,b,c∈Ga,b,c\in G 有 (a∗b)∗c=a∗(b∗c)(a*b)*c=a*(b*c);单位元:存在 e∈Ge\in G,使得对所有的 a∈Ga\in G,都有转载 2017-07-26 15:52:48 · 1553 阅读 · 0 评论 -
[HDU]-6055 Regular polygon
Regular polygonURL: http://acm.hdu.edu.cn/showproblem.php?pid=6055Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 86 Accepted Submission(s):原创 2017-07-27 17:48:03 · 433 阅读 · 0 评论 -
[51NOD] 1004 n^n的末位数字 [数学]
给出一个整数N,输出N^N(N的N次方)的十进制表示的末位数字。 Input 一个数N(1 <= N <= 10^9) Output 输出N^N的末位数字 Input示例 13 Output示例 3题解我们仅取末尾数值然后快速幂即可#include<stdio.h>int main(){ int n; scanf("%d",&n); int a=n%10;原创 2017-02-27 11:24:06 · 411 阅读 · 0 评论 -
[51NOD] 1009 数字1的数量 [数学][详解]
给定一个十进制正整数N,写下从1开始,到N的所有正数,计算出其中出现所有1的个数。 例如:n = 12,包含了5个1。1,10,12共包含3个1,11包含2个1,总共5个1。 Input 输入N(1 <= N <= 10^9) Output 输出包含1的个数 Input示例 12 Output示例 5题解提供一组数据 输入127948输出99344 不是很好想记n的长度为LL,设原创 2017-03-04 20:22:45 · 556 阅读 · 0 评论 -
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 number o原创 2017-02-16 15:27:11 · 351 阅读 · 0 评论 -
文章标题
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].Now原创 2017-02-16 16:16:26 · 191 阅读 · 0 评论 -
Harmonic Number (II) [数学]
I was trying to solve problem ‘1234 - Harmonic Number’, I wrote the following codelong long H( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) res = res + n / i; return r原创 2017-02-17 13:21:54 · 347 阅读 · 0 评论 -
GCD - Extreme (II) [欧拉函数]
G=0;for(i=1;i<N;i++) for(j=i+1;j<=N;j++) { G+=gcd(i,j); }/*Here gcd() is a function that findsthe greatest common divisor of the twoinput numbers*/InputThe input file contains a原创 2017-02-17 15:11:00 · 577 阅读 · 0 评论 -
Pairs Forming LCM [数学][最小公倍数为n的数对]
Find the result of the following code:long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) == n ) re原创 2017-02-17 16:58:08 · 492 阅读 · 0 评论 -
[51NOD]1256 乘法逆元
给出2个数M和N(M < N),且M与N互质,找出一个数K满足0 < K < N且K * M % N = 1,如果有多个满足条件的,输出最小的。 Input 输入2个数M, N中间用空格分隔(1 <= M < N <= 10^9) Output 输出一个数K,满足0 < K < N且K * M % N = 1,如果有多个满足条件的,输出最小的。 Input示例 2 3 Output示例原创 2017-02-18 17:42:33 · 366 阅读 · 0 评论 -
[HPU] Bet [数学]
题目描述 Josnch星球是一个赌博之风盛行的星球。每个人一出生就有一定数额的钱,之后的所有收入只能由赌博获得(OMG,如果RP不好,输光了所有的钱。。。)假设赌博公司的某场赌博有 N 个结果,每个结果能获得的赔率比分别是 a[1],a[2]…a[N]。假设现在XXX有 X 块钱,问他选择怎样的策略才能使得最坏情况下回报最大?假设 N 个结果中只有一个是有回报的,X块钱必须全部用在这次赌博上,赔率原创 2017-02-21 11:48:53 · 483 阅读 · 0 评论 -
[51NOD] 1003 阶乘后面0的数量 [数学]
n的阶乘后面有多少个0? 6的阶乘 = 1*2*3*4*5*6 = 720,720后面有1个0。 Input 一个数N(1 <= N <= 10^9) Output 输出0的数量 Input示例 5 Output示例 1题解将n分解 n!=2a13a25a37a4…n!=2^{a_1}3^{a_2}5^{a_3}7^{a_4}… n!末尾零的个数及n!的因子10的个数,而10=原创 2017-02-27 11:13:11 · 766 阅读 · 0 评论 -
Aladdin and the Flying Carpet [整数分解]
It’s said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery.Aladdin was about to enter to a magical原创 2017-02-15 20:34:30 · 579 阅读 · 0 评论 -
[HPUOJ]1076: 杨辉大三角 [逆元]
杨辉三角是个经典的数据模型,它形如:KACA现在不满足求这些很小的数,他想要知道当nn和mm都比较大的时候的杨辉三角第nn行第mm列的值是多少。输入第一行有一个数字T(T≤2000)T(T≤2000)代表有TT组数据。下面有T行,每一行有两个数字n(1≤n≤106),m(0≤m≤n)n(1≤n≤106),m(0≤m≤n)。输出对于每一原创 2017-02-16 10:31:37 · 561 阅读 · 0 评论 -
Kolya and Tanya [组合数学]
Kolya loves putting gnomes at the circle table and giving them coins, and Tanya loves studying triplets of gnomes, sitting in the vertexes of an equilateral triangle.More formally, there are 3n gnomes原创 2017-03-04 10:30:48 · 429 阅读 · 0 评论 -
[51NOD]1284-2 3 5 7的倍数 [容斥]
给出一个数N,求1至N中,有多少个数不是2 3 5 7的倍数。 例如N = 10,只有1不是2 3 5 7的倍数。 Input 输入1个数N(1 <= N <= 10^18)。 Output 输出不是2 3 5 7的倍数的数共有多少。 Input示例 10 Output示例 1题解简单的容斥题,分析看这儿》》传送门#include<cstdio>#include<string.h>原创 2017-03-04 14:59:11 · 338 阅读 · 0 评论 -
[51NOD]1283 最小周长[数学]
一个矩形的面积为S,已知该矩形的边长都是整数,求所有满足条件的矩形中,周长的最小值。例如:S = 24,那么有{1 24} {2 12} {3 8} {4 6}这4种矩形,其中{4 6}的周长最小,为20。 Input 输入1个数S(1 <= S <= 10^9)。 Output 输出最小周长。 Input示例 24 Output示例 20题解#include<cstdio>#in原创 2017-03-04 15:44:08 · 612 阅读 · 0 评论 -
斐波那契数列 通项公式 [数学]
2007年到来了。经过2006年一年的修炼,数学神童zouyu终于把0到100000000的Fibonacci数列 (f[0]=0,f[1]=1;f[i] = f[i-1]+f=2”>i-2)的值全部给背了下来。 接下来,CodeStar决定要考考他,于是每问他一个数字,他就要把答案说出来,不过有的数字太长了。所以规定超过4位的只要说出前4位就可以了,可是CodeStar自己又记不住。于是他原创 2017-03-08 07:58:33 · 1284 阅读 · 0 评论 -
[poj]1118 Lining Up [思维][数学][尺取]
Description “How am I ever going to solve this problem?” said the pilot. Indeed, the pilot was not facing an easy task. She had to drop packages at specific points scattered in a dangerous area. Furth原创 2017-03-07 13:15:35 · 393 阅读 · 0 评论 -
[HDU]1402 A * B Problem Plus [FFT]
Problem Description Calculate A * B.Input Each line will contain two integers A and B. Process to end of file.Note: the length of each integer will not exceed 50000.Output For each case, output A *原创 2017-08-07 13:05:17 · 350 阅读 · 0 评论