数论
文章平均质量分 79
wanghandou
我是个爱学习的孩子
展开
-
简单的数论
简单的数论Crawling in process...Crawling failedTime Limit:3000MS Memory Limit:32768KB 64bit IO Format:%lld & %lluSubmit Status Practice LightOJ 1245 uDebugDescription原创 2016-08-06 08:25:50 · 335 阅读 · 0 评论 -
Prime Time
题目链接题意:让你找a~b之间的数i,根据这个式子,根据这个式子的结果是不是素数,找出a~b之间素数的占的比率*100.注意精度问题#include#include#include#includeusing namespace std;#define LL long longint prim[100000005];int num[10005];int we(int n)//原创 2017-04-30 15:04:55 · 606 阅读 · 0 评论 -
Farey Sequence
Farey SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16270 Accepted: 6463DescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the se原创 2017-04-30 16:18:14 · 236 阅读 · 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 exactlyx days. Now RC-01 produces exactly p new deadly Bacteria wherex原创 2017-04-30 19:42:50 · 719 阅读 · 0 评论 -
Extreme (II)
题目链接题意: 计算gcd(1,n)+gcd(2,n)+...+gcd(n-1, n);解题思路: 1. 设f(n) = gcd(1,n)+gcd(2,n)+...+gcd(n-1,n); s(n) = f(2)+f(3)+...+f(n) (n>=2); 即: s(n) = s(n-1)+f(n); 2原创 2017-04-30 21:28:34 · 308 阅读 · 0 评论 -
Fantasy of a Summation
If you think codes, eat codes then sometimes you may get stressed. In your dreams you may see huge codes, as I have seen once. Here is the code I saw in my dream.#include int cases, caseno;int原创 2017-05-01 11:28:22 · 474 阅读 · 0 评论 -
Looooops
C LooooopsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 26379 Accepted: 7508DescriptionA Compiler Mystery: We are given a C-language style for loop of t原创 2017-05-01 21:19:47 · 319 阅读 · 0 评论 -
Maximum GCD
就是输入有点问题,找最大的时候可以暴力#include#include#include#includeusing namespace std;int gcd(int a,int b){ if(b==0) return a; else return gcd(b,a%b);}char a[10005];int b[10005];i原创 2017-04-16 12:50:26 · 258 阅读 · 0 评论 -
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 integer T原创 2017-04-16 15:37:22 · 311 阅读 · 0 评论 -
The equation
There is an equation ax + by + c = 0. Given a,b,c,x1,x2,y1,y2 you must determine, how many integer roots of this equation are satisfy to the following conditions : x1InputInput contains integer nu转载 2017-05-02 15:48:21 · 663 阅读 · 0 评论 -
Sigma Function
Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24) = 1+2+3+4转载 2017-04-17 14:40:08 · 793 阅读 · 0 评论 -
2016
给出正整数 n 和 m,统计满足以下条件的正整数对 (a,b) 的数量:1. 1≤a≤n,1≤b≤m;2. a×b 是 2016 的倍数。Input输入包含不超过 30 组数据。每组数据包含两个整数 n,m (1≤n,m≤10 9).Output对于每组数据,输出一个整数表示满足条件的数量。原创 2017-04-29 08:11:45 · 241 阅读 · 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 knowN! = 1*2*...*N. For example, 5! = 120, 120 contains one zero on the原创 2017-04-28 10:10:36 · 400 阅读 · 0 评论 -
简单的数论2
F - 简单的数论2Crawling in process...Crawling failedTime Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %lluSubmit Status Practice LightOJ 1370 uDebugDescript原创 2016-08-08 11:18:59 · 280 阅读 · 0 评论 -
除法表达式
除法表达式时间限制:1000 ms | 内存限制:65535 KB难度:3描述 给出一个这样的除法表达式:X1/X2/X3/···/Xk,其中Xi是正整数。除法表达式应当按照从左到右的顺序求和,例如表达式1/2/1/2的值为1/4。但是可以在表达式中嵌入括号以改变计算顺序,例如表达式(1/2)/(1/2)的值为1.输入首先输入一个N,表示有N组测原创 2017-02-27 16:07:19 · 886 阅读 · 0 评论 -
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 to go原创 2017-04-07 19:33:39 · 249 阅读 · 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 [1].原创 2017-04-07 21:26:52 · 837 阅读 · 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 res = res + n / i; return res; }Yes, my erro原创 2017-04-08 09:56:52 · 340 阅读 · 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 ofnk.InputInput starts with an integer T (≤ 1000), denoting the nu转载 2017-04-08 12:50:31 · 512 阅读 · 0 评论 -
Aladdin and the Flying Carpet
Aladdin and the Flying CarpetPDF (English)StatisticsForumTime Limit: 3 second(s)Memory Limit: 32 MBIt's said that Aladdin had to solve seven mysteries b原创 2017-04-08 17:12:50 · 294 阅读 · 0 评论 -
Divide by Six
无解时输出-1s而不是WTF数据可能有前导零Input file: standard inputOutput file: standard output Time limit: 1 secondMemory limit: 512 mebibytesA positive integer number n is written on a blackboard. It consist原创 2017-04-12 14:48:02 · 505 阅读 · 0 评论 -
Friends number
Paula and Tai are couple. There are many stories between them. The day Paula left by airplane, Tai send one message to telephone 2200284, then, everything is changing… (The story in “the snow queen”).原创 2017-04-12 19:36:36 · 643 阅读 · 0 评论 -
Pairs Forming LCM
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) ==原创 2017-04-27 17:33:14 · 338 阅读 · 0 评论