
ACM 数论
Astralis的Xyp9x本 人
这个作者很懒,什么都没留下…
展开
-
ACM 数论 Interesting Integers
题目:Undoubtedly you know of the Fibonacci numbers. Starting with F_1 = 1F1=1 and F_2 = 1F2=1,every next number is the sum of the two previous ones. This results in the sequence 1, 1, 2, 3, 5, 8, 13, ...原创 2018-07-11 13:18:24 · 218 阅读 · 0 评论 -
抱歉
题目:非常抱歉,本来兴冲冲地搞一场练习赛,由于我准备不足,出现很多数据的错误,现在这里换一个简单的题目:前几天在网上查找ACM资料的时候,看到一个中学的奥数题目,就是不相交的曲线段分割平面的问题,我已经发到论坛,并且lxj 已经得到一个结论,这里就不多讲了,下面有一个类似的并且更简单的问题:如果平面上有n个点,并且每个点至少有2条曲线段和它相连,就是说,每条曲线都是封闭的,同时,我...原创 2019-07-15 10:50:16 · 128 阅读 · 0 评论 -
无平方因子的数(Eratosthenes筛法)
题目:给出正整数n和m,区间[n,m]内的“无平方因子”的数有多少个?整数p无平方因子,当且仅当不存在k>1,使得p是k*k的倍数。1<=n<=m<=10^12,m-n<=10^7;分析:思路都是紫书上的,只是实现一下;代码:#include<stdio.h>#include<string.h>#include<m...原创 2018-08-24 12:14:12 · 973 阅读 · 1 评论 -
连续正整数
题目:一个正整数有可能被表示为 n(n>=2) 个连续正整数之和,如:15=1+2+3+4+515=4+5+615=7+8请编写程序,根据输入的任何一个正整数,找出符合这种要求的所有连续正整数序列。输入数据:一个正整数,以命令行参数的形式提供给程序。输出数据:在标准输出上打印出符合题目描述的全部正整数序列,每行一个序列,每个序列都从该序列的最小正整数开始、以从小到...原创 2018-08-28 00:02:32 · 789 阅读 · 1 评论 -
三角形的内点(皮克定理)
题目:在一个平面坐标系中,我们可以选出三个不全在一条线上的点构成一个三角形。我们称一个在三角形内(不包含三角形的边上),横纵坐标皆为整数的点位这个三角形的内点。 对于一个由(0,0)、(n,m)、(p,0)作为顶点构成的三角形,请你设计程序求出他的内点数。输入包括一行,包括三个用空格分隔的整数,分别为n,m,p(0 ≤ n < 32000,0 < m < 32000,0 ...原创 2018-08-27 18:55:17 · 6752 阅读 · 0 评论 -
简单素数筛法(顾名思义)
题目:小度机器人最近正在添加功能,Robin希望小度机器人可以告诉他从1到N( 1 < N <= 10000)有多少个素数。请你来帮帮他吧?输入包括一行,仅一个数字N。输出在(1, N]区间内的所有的素数。分析:..........代码:#include<stdio.h>#include<math.h>using namespa...原创 2018-08-27 11:34:43 · 180 阅读 · 0 评论 -
微信钱包付款(数论 大数)
题目:微信支付是腾讯公司的支付业务品牌,以绑定银行卡的快捷支付为基础,为用户提供安全、快捷、高效的支付服务。小 Q 和他的两位好朋友一起去吃大餐,吃完后小 Q 打开微信,扫了商家提供的二维码,用微信完成了支付。现在三个人要分摊下饭钱,每个人分别需要支付 aa元,bb 元和 cc 元,定义 f(x)f(x) 为数字 xx 的各位数字之和,例如 f(123) = 1 + 2 + 3f(123)=1...原创 2018-08-27 11:21:47 · 388 阅读 · 0 评论 -
Find Integer(费马大定理)
题目:题意:a^n+b^n=c^n,给出a,n,求出一组b,c;分析:根据费马大定理,n>2的所有情况可以排除,n=0无结果,n=1随便写,剩下的就是n=2,利用勾股数的性质就可以写出;代码:#include<stdio.h>using namespace std;int main(){ int t,a,n,b,c; scanf...原创 2018-08-26 12:04:58 · 287 阅读 · 0 评论 -
Cure
Given an integer nn, we only want to know the sum of 1/k^21/k2 where kk from 11 to nn.Input FormatThere are multiple cases.For each test case, there is a single line, containing a single positiv...原创 2018-08-15 09:07:41 · 595 阅读 · 0 评论 -
Prime Time (数论打表)
题目:Euler is a well-known matematician, and, among many other things, he discovered that the formula n 2 + n + 41 produces a prime for 0 ≤ n < 40. For n = 40, the formula produces 1681, which is 4...原创 2018-07-27 17:13:25 · 319 阅读 · 1 评论 -
Bi-shoe and Phi-shoe
题目:Bamboo Pole-vault is a massively popular sport in Xzhiland. And Master Phi-shoe is a very popular coach for his success. He needs some bamboos for his students, so he asked his assistant Bi-Shoe ...原创 2018-07-22 11:47:06 · 267 阅读 · 0 评论 -
Farey Sequence (欧拉函数)
题目:The Farey Sequence Fn for any integer n with n >= 2 is the set of irreducible rational numbers a/b with 0 < a < b <= n and gcd(a,b) = 1 arranged in increasing order. The first few are...原创 2018-07-26 11:09:23 · 246 阅读 · 0 评论 -
ACM Divisions
题目:题意:求一个大数的因子个数分析:怎么说呢,这道题已经超出了我现在所能理解的范围,所以借鉴网上大佬的代码:http://www.cnblogs.com/ZERO-/p/9302169.html#include<iostream>#include<algorithm>#include<cstring>#include<iomanip>#includ...转载 2018-07-13 18:05:54 · 225 阅读 · 0 评论 -
Take Your Seat
题目:题意:有两个问题,第一个,有n个人,n个座位,按顺序上去,1号丢了号码牌,问最后一个人上去做对位置的概率;第二个:m个人,随机上去,m个座位,问最后一个人上去做对的概率;分析:第一题:很显然,n=1时,概率为1,n=2时概率为0.5,那么我们设想n为很大的时候,如果上去坐在了自己的位置上,那么自然后面的都能做对,如果上去直接坐在了n的位置上,那么n一定做不对,如果坐...原创 2018-07-18 13:43:22 · 1694 阅读 · 2 评论 -
Harmonic Number
题目:In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers:In this problem, you are given n, you have to find Hn.InputInput starts with an inte...原创 2018-07-23 16:24:56 · 187 阅读 · 0 评论 -
Primes
题目:Write a program to read in a list of integers and determine whether or not each number is prime. A number, n, is prime if its only divisors are 1 and n. For this problem, the numbers 1 and 2 are ...原创 2018-07-23 15:46:21 · 299 阅读 · 0 评论 -
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 ...原创 2018-07-23 15:15:03 · 991 阅读 · 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...原创 2018-07-23 13:01:15 · 209 阅读 · 0 评论 -
D - Primed Subsequence
题目大意;定义素数序列为长度大于等于2的切其中每个数之和为素数的一个数列,题目给出数列,让我们求出最短的素数序列,如果有长度相同的,则输出最先出现的。思路:先素数打表,考虑到是区间问题,直接用一个数组s[i]记录前i个数的和;代码:#include<stdio.h>#include<string.h>#include<math.h>using ...原创 2019-09-06 14:58:15 · 394 阅读 · 0 评论