数学
qq_37383726
这个作者很懒,什么都没留下…
展开
-
[牛客国庆集训派对Day1] C[数学] L[最短路] J[线段树]
比赛链接C链接:https://www.nowcoder.com/acm/contest/201/C来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 1048576K,其他语言2097152K64bit IO Format: %lld题目描述算术是为数不多的会让Kuon感到棘手的事情。通常她会找Haku帮忙,但是Haku已经被她派去买东西了。于是她向你寻求帮...原创 2018-10-02 09:44:57 · 341 阅读 · 0 评论 -
【第八届河南理工大学程序设计大赛(正式赛)】 BDE F GHIJKLM
问题 F: GCD与LCM 题目描述 Ocean某天遇到了一个很简单的数学题,但是他的大脑已经超负荷了。现在请你帮帮他吧:已知D = GCD(x, y) + LCM(x, y),求合法组合(x, y)总数,其中x > 0且y > 0。输入 第一行输入一个整数T,代表有T组测试数据。接下来每行输入一个整数D。注:1<=T,D<=1051<=T,D<=105。输出 对每组测试数据,输出一个整数代原创 2017-12-11 21:28:20 · 1267 阅读 · 0 评论 -
【第五届“图灵杯”NEUQ-ACM程序设计大赛】A C D【哈夫曼树】E【手写链表】 F G H【圆周排列生成】 I
A 逃出生天 题目描述: gold学长从昏迷中醒来以后发现自己被困在一个山洞里,他找了很久,终于找到一个门。门上写着:想要逃出去,只有一个办法 你可以选择一个数n,设m=1 * 2 * … * (n-1)。如果m是n的倍数,那么门就会自动打开,否则你就别想出去了。 gold学长内心充满了绝望,他想了一些数,但他不知道这些数能不能保证自己逃出去。你能帮助gold学长逃出生天吗? 输入: 第一原创 2017-12-04 15:40:40 · 1072 阅读 · 0 评论 -
【LightOJ - 1116】Ekka Dokka 【算数基本定理】
Ekka and his friend Dokka decided to buy a cake. They both love cakes and that’s why they want to share the cake after buying it. As the name suggested that Ekka is very fond of odd numbers and Dokka i原创 2017-11-17 08:34:27 · 326 阅读 · 0 评论 -
【HDU - 4196】Remoteland 【逆元+算数基本定理】
In the Republic of Remoteland, the people celebrate their independence day every year. However, as it was a long long time ago, nobody can remember when it was exactly. The only thing people can rememb原创 2017-11-13 21:39:01 · 324 阅读 · 0 评论 -
【CodeForces - 849】A【思维】 B【暴力】C【思维+构造】
A Odds and Ends Where do odds begin, and where do they end? Where does hope emerge, and will they ever break?Given an integer sequence a1, a2, …, an of length n. Decide whether it is possible to divi原创 2017-10-23 23:39:57 · 336 阅读 · 0 评论 -
【POJ - 2689】 Prime Distance 【素数区间筛】
The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of primalit原创 2017-10-03 22:11:45 · 285 阅读 · 0 评论 -
【 UVa 10139】 Factovisors 【 m | n!? 】
分析 由唯一分解定理,我们可知道 m=p1^r1*p2^r2……pn^rn (p为素数)。 如果n!要想被m整除,必须也至少有 p1^r1*p2^r2……pn^rn 。 另外 注意在O(log n / log p)时间内求出n!的质因子分解中质数p的指数:(勒让德定理的简化算法)inline int getn(int n, int p) { int sum = 0;原创 2017-08-14 19:43:00 · 384 阅读 · 0 评论 -
【HDU - 206】 小兔的棋盘 【Catalan 数】
小兔的叔叔从外面旅游回来给她带来了一个礼物,小兔高兴地跑回自己的房间,拆开一看是一个棋盘,小兔有所失望。不过没过几天发现了棋盘的好玩之处。从起点(0,0)走到终点(n,n)的最短路径数是C(2n,n),现在小兔又想如果不穿越对角线(但可接触对角线上的格点),这样的路径数有多少?小兔想了很长时间都没想出来,现在想请你帮助小兔解决这个问题,对于你来说应该不难吧! Input 每次输入一个数n(1<=原创 2017-08-14 16:52:21 · 214 阅读 · 0 评论 -
【HDU - 2058 】The sum problem 【高斯公式】
Given a sequence 1,2,3,……N, your job is to calculate all the possible sub-sequences that the sum of the sub-sequence is M. Input Input contains multiple test cases. each case contains two integers N,原创 2017-08-14 12:41:20 · 350 阅读 · 0 评论 -
【HDU - 1432 】Lining Up 【几何,三点共线】
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. Furthermore, the pi原创 2017-08-14 10:47:33 · 317 阅读 · 0 评论 -
【CodeFores 948 】B【筛法+思维】C【树状数组+思维】
B. Primal Sport time limit per test1.5 seconds memory limit per test256 megabytes inputstandard input outputstandard output Alice and Bob begin their day with a quick game. They first choose a st...原创 2018-03-15 18:26:53 · 161 阅读 · 0 评论 -
【牛客练习赛13】D 幸运数字Ⅳ 【康拓展开】
链接:https://www.nowcoder.com/acm/contest/70/D 来源:牛客网时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 定义一个数字为幸运数字当且仅当它的所有数位都是4或者7。 比如说,47、744、4都是幸运数字而5、17、467都不是。 ...原创 2018-03-19 21:55:01 · 360 阅读 · 0 评论 -
[Wannafly挑战赛25 ] A B C[概率DP]
A链接:https://www.nowcoder.com/acm/contest/197/A来源:牛客网时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288K64bit IO Format: %lld题目描述令 X = n!, 给定一大于1的正整数p 求一个k使得 p ^k | X 并且 p ^(k + 1) 不是X的因子。输入描述:...原创 2018-10-02 09:17:30 · 153 阅读 · 0 评论 -
【HDU 6397】Character Encoding 【生成函数公式推导】
In computer science, a character is a letter, a digit, a punctuation mark or some other similar symbol. Since computers can only process numbers, number codes are used to represent characters, which i...原创 2018-08-21 21:52:41 · 242 阅读 · 0 评论 -
【HDU 6411】带劲的and和 【并查集 + 二进制拆位】
度度熊专门研究过“动态传递闭包问题”,他有一万种让大家爆蛋的方法;但此刻,他只想出一道简简单单的题——至繁,归于至简 度度熊有一张n个点m条边的无向图,第i个点的点权为viviv_i。 如果图上存在一条路径使得点i可以走到点j,则称i,j是带劲的,记f(i,j)=1;否则f(i,j)=0。显然有f(i,j)=f(j,i)。 度度熊想知道求出: ∑n−1i=1∑nj=i+1f(i,j)×m...原创 2018-08-21 13:15:09 · 311 阅读 · 0 评论 -
【HDU 6410】序列期望 【期望 + 数学】
Problem Description “看似随机,实则早已注定”——光羽度度熊有n个随机变量x1,x2,...,xnx1,x2,...,xnx_1,x_2,...,x_n。给定区间[l1,r1],...,[ln,rn][l1,r1],...,[ln,rn][l_1, r_1],...,[l_n, r_n],变量xixix_i的值会等概率成为区间[li,ri][li,ri][l_i,r_i]...原创 2018-08-21 12:55:34 · 1036 阅读 · 0 评论 -
【LightOJ - 1220 】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-04-12 16:52:20 · 464 阅读 · 0 评论 -
【LightOJ 1236】 Pairs Forming LCM 【算术基本定理+排列组合】
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 ) res++; // lcm means least common ...原创 2018-04-12 16:22:27 · 147 阅读 · 0 评论 -
【LightOJ - 1098 】A New Function 【数论+思维】 1-n 每个数的因子的和
We all know that any integer number n is divisible by 1 and n. That is why these two numbers are not the actual divisors of any numbers. The function SOD(n) (sum of divisors) is defined as the summati...原创 2018-03-29 12:01:05 · 710 阅读 · 0 评论 -
【LightOJ - 1245】 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; ...原创 2018-04-03 16:27:58 · 208 阅读 · 0 评论 -
【LightOJ 】 Trailing Zeroes (I) (II) (III) 【数论 】
Trailing Zeroes (I)We know what a base of a number is and what the properties are. For example, we use decimal number system, where the base is 10 and we use the symbols - {0, 1, 2, 3, 4, 5, 6, 7,...原创 2018-04-03 12:53:35 · 382 阅读 · 0 评论 -
【LightOJ - 1278】 Sum of Consecutive Integers 【简单公式变形-算数基本定理】
Given an integer N, you have to find the number of ways you can express N as sum of consecutive integers. You have to use at least two integers.For example, N = 15 has three solutions, (1+2+3+4+5), ...原创 2018-03-30 10:18:47 · 417 阅读 · 0 评论 -
【 HDUOJ 5053 】 the Sum of Cube 【立方和公式】
Problem Description A range is given, the begin and the end are both integers. You should sum the cube of all the integers in the range.Input The first line of the input is T(1 <= T <= 1000), which s原创 2017-08-13 17:04:50 · 355 阅读 · 0 评论 -
【Loj 1282 】 Leading and Trailing 【a^b 的前3位and后三位】
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-08-05 21:31:14 · 218 阅读 · 0 评论 -
【HPUOJ 1416】Kick Ass Biu 【几何】
题目描述 在玩Kick Ass的时候,可以发现子弹的发射与飞船的移动非常有趣。假设屏幕是个n×mn×m(竖直为n,水平为m)的矩形,以矩形左下角为原点,水平方向为x轴,向右为正方向,竖直方向为y轴,像上为正方向,建立平面直角坐标系。你的飞船在(x1,y1)点,射击目标在(x2,y2),你向目标发出了一发子弹,然而由于网页卡顿,这枚子弹并不会触碰到目标。所以,子弹将以每秒v单位的速度继续前进,若子弹原创 2017-08-12 22:02:56 · 218 阅读 · 0 评论 -
求n!的末尾有几个0
可以知道就是 求n!中一共有多少个5这个因子;因为2*5为10.一定会出现个零。 2的个数肯定又比5多,所以就是求5的个数 代码#include <bits/stdc++.h>using namespace std;#define inf 0x3f3f3f3fconst int MAXN = 100000;const int MAXM = 1e6+100;const double PI原创 2017-05-29 17:11:07 · 743 阅读 · 0 评论 -
地狱飞龙 【simpson 求积分】
题目描述最近clover迷上了皇室战争,他抽到了一种地狱飞龙,很开心。假设地域飞龙会对距离为d的敌人每秒造成k/d2伤害。假设地域飞龙位于坐标轴原点,以每秒v1的速度向y轴正方向移动,敌人在(x,0)的位置,以每秒v2的速度向x轴负方向移动。问,敌人至少有多少血量永远才不会被地狱飞龙喷死。(伤害是连续造成的,不是一秒一秒间断的)输入第一行为数据组数T(1<=T<=1000) 每组数据一行,包含4原创 2017-05-29 16:06:53 · 520 阅读 · 0 评论 -
Non-square Equation 【数学公式】
Let’s consider equation:x2 + s(x)·x - n = 0, where x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.You are given an integer n, fi原创 2017-04-13 22:13:40 · 535 阅读 · 0 评论 -
基本数论
#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>#include<math.h>#include<queue>#include<stack>#include<map>#include<vector>#include<set>#define LL long long#define M原创 2017-04-06 21:41:01 · 203 阅读 · 0 评论 -
序号互换 【进制转换】
序号互换 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 Dr.Kong设计了一个聪明的机器人卡多,卡多会对电子表格中的单元格坐标快速计算出来。单元格的行坐标是由数字编号的数字序号,而列坐标使用字母序号。观察字母序号,发现第1列到第26列的字母序号分别为A,B,…,Z,接着,第27列序号为AA,第28列为AB,依此类推。 若给Dr.Kong的机器人卡多一个数字原创 2017-03-29 13:46:25 · 269 阅读 · 0 评论 -
三足鼎立 【水题】
三足鼎立Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4025 Accepted Submission(s): 2296Problem Description MCA山中人才辈出,洞悉外界战火纷纷,山中各路豪杰决定出山拯救百姓于原创 2017-03-29 13:12:04 · 667 阅读 · 0 评论 -
Ignatius's puzzle 【数学】+【抽屉原理】
Ignatius’s puzzle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7082 Accepted Submission(s): 4891Problem Description Ignatius is poor at原创 2017-03-29 12:50:00 · 337 阅读 · 0 评论 -
问题 C: 神奇的数字9 【数学】
问题 C: 神奇的数字9时间限制: 1 Sec 内存限制: 128 MB 题目描述给定一个数N(没有前导0)和Q次操作,每次操作修改第i位数字 为 v(保证不会把第一位修改为0),对每次操作判定新数能否被9整除。若满足被9整除输出1,反之输出0。输入有多组测试数据,请处理到文件结束。每组数据有两个整数N和Q,接下来有Q行代表Q次操作,每行原创 2017-03-12 22:51:15 · 640 阅读 · 0 评论 -
数学小知识
1 高斯求和公式 代码while (~scanf("%lld %lld",&n,&m) && (n || m)) { for (int i = sqrt((double)(2*n)) ; i > 0 ; i--) { if ((2 * m) % i == 0 && ((2 * m / i) + i - 1) %原创 2017-03-28 20:42:04 · 213 阅读 · 0 评论 -
保护果实 【 数学几何】+【贪心】
保护果实Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)Submit StatusA有一棵果树,但是树上的果子总是还没有成熟就被B偷偷摘走了。于是,A想买一些栅栏想把果树围起来,让B再也偷不了果子。卖栅栏的人有N块栅栏,每块栅栏长度为原创 2017-03-28 00:03:20 · 323 阅读 · 0 评论 -
无线网络覆盖
无线网络覆盖时间限制:3000 ms | 内存限制:65535 KB难度:3描述我们的乐乐同学对于网络可算得上是情有独钟,他有一个计划,那就是用无线网覆盖郑州大学。现 在学校给了他一个机会,因此他要购买很多的无线路由。现在他正在部署某条大道的网络,而学校只允许把他的无线路由器放在路的正中间。我们默认这条大道是笔 直的并且它在任何地方的宽度都一样。并且所有的路由器原创 2017-02-25 10:48:36 · 330 阅读 · 0 评论 -
【HPUOJ 1410:】QAQ & 火星情报局 【哥德巴赫猜想】
题目描述 QAQ~超级喜欢看火星情报局,每周六都是他一周中最期待的一天,QAQ喜欢和自己一样心愿是“世界和平”的薛之谦,喜欢“一言不合就飙车”的宇哥,喜欢“再扯的提案都能升华为鸡汤”的汪涵局长….当然也喜欢的里面各种各样奇葩有趣的提案…..最近 K 星颁布了一项新的法律,所有 K 星的公民必须缴纳的所得税是收入 money 的最大因子 o 且 ( o≠moneyo≠money ) ,做为一名 AC原创 2017-08-12 21:49:42 · 1659 阅读 · 0 评论 -
【ZZULIOJ 2180】GJJ的日常之沉迷数学 【逆元 or 矩阵快速幂】
DescriptionGJJ每天都要膜拜一发数学大佬,因为GJJ的数学太差了。这不,GJJ又遇到难题了,他想求助WJJ,但是WJJ这几天忙于追妹子,哪有时间给他讲题, 于是GJJ求助于热爱ACM的你,Acmer们能帮帮他吗?问题是求: k^0 + k^1 +…+ k^(n) mod p (0 < k < 100, 0 <= n <= 10^9, p = 1000000007) 例如:6^0 + 6原创 2017-08-19 10:29:48 · 374 阅读 · 0 评论 -
【hdu 6069】 Counting Divisors 【思维+数论】
Problem Description In mathematics, the function d(n) denotes the number of divisors of positive integer n.For example, d(12)=6 because 1,2,3,4,6,12 are all 12’s divisors.In this problem, given l,r an原创 2017-08-03 20:51:19 · 269 阅读 · 0 评论