随笔分类 - 初等数论
摘要:/*POJ-2356 Find a multiple ----抽屉原理Find a multipleTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 4228 Accepted: 1850 Special JudgeDescriptionThe input contains N natural (i.e. positive integer) numbers ( N #include#include#includeusing namespace std;#define maxn 16...
        阅读全文
            
摘要:/*PROBLEMSSUBMITSTATUSSTANDINGSCUSTOM TESTB. T-primestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe know that prime numbers are positive integers that have exactly two distinct positive divisors. Similarly, we'll call a positive integer t
        阅读全文
            
摘要:Prime CutsTime Limit:1000MSMemory Limit:10000KTotal Submissions:9339Accepted:3562DescriptionA prime number is a counting number (1, 2, 3, ...) that is evenly divisible only by 1 and itself. In this problem you are to write a program that will cut some number of prime numbers from the list of prime n
        阅读全文
            
摘要:Prime GapTime Limit:5000MSMemory Limit:65536KTotal Submissions:7392Accepted:4291DescriptionThe sequence of n − 1 consecutive composite numbers (positive integers that are not prime and not equal to 1) lying between two successive prime numberspandp+nis called a prime gap of lengthn. For example, ‹24
        阅读全文
            
摘要:/*微软招聘信息(主要针对已经有工作经验的) 又见GCDTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6407 Accepted Submission(s): 2634Problem Description有三个正整数a,b,c(0<a,b,c<10^6),其中c不等于b。若a和c的最大公约数为b,现已知a和b,求满足条件的最小的c。 Input第一行输入一个n,表示有n组测试数据,接下来的n行,每行输入两个正整数a,b。 Ou
        阅读全文
            
摘要:Leftmost DigitTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8784 Accepted Submission(s): 3391Problem DescriptionGiven a positive integer N, you should output the leftmost digit of N^N. InputThe input contains several test cases. The first ...
        阅读全文
            
摘要:Eddy's digital RootsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2433 Accepted Submission(s): 1391 Problem DescriptionThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single 
        阅读全文
            
摘要:Problem HTime Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 6 Accepted Submission(s) : 2Font: Times New Roman | Verdana | GeorgiaFont Size: ← →Problem Description The most important part of a GSM network is so called Base Transceiver Station (BTS). Th
        阅读全文
            
摘要:/*2^x mod n = 1 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6738 Accepted Submission(s): 2022Problem Description Give a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1.Input One positive integer on each line, the value of n.
        阅读全文
            
摘要:A+B ComingTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3359 Accepted Submission(s): 2087 Problem DescriptionMany classmates said to me that A+B is must needs. If you can’t AC this problem, you would invite me for night meal. ^_^InputInpu...
        阅读全文
            
摘要:int x,y,d;void exp_gcd(int a,int b){int temp;if(b==0){x=1;y=0;d=a;//最大公约数为d}else//必须有{ exp_gcd(b,a%b); temp=x; x=y; y=temp-(a/b)*y;}} int x,y;int exp_gcd(int a,int b)//返回值为最大公约数{int temp,p;if(b==0){x=1;y=0;return a;}else//这里的else可以不要,因为return了就不会做下面。{ p=exp_gcd(b,a%b); temp=x; x=y; y=temp-(a/b)*y;re
        阅读全文
            
摘要:Problem Description要求(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 1000 53 87 123456789Sample Output7922 6060#include<iostream>#include<stdio.h>#incl
        阅读全文
            
摘要:Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的青蛙,你被要求写一个程序来判断这两只青蛙是否能够碰面,会在什么时候碰面。 我们把这两只青蛙分别叫做青蛙A和青蛙B,并且规定纬度线上东经0度处为原点,由东往西为正方向,单位长度1米,这样
        阅读全文
            
摘要:/*Raising Modulo NumbersTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 3555Accepted: 1964DescriptionPeople are different. Some secretly read magazines full of interesting girls' pictures, others create an A-bomb in their cellar, others like using Windows, and some like difficult mathem
        阅读全文
            
摘要:/*DescriptionGiven n, a positive integer, how many positive integers less than n are relatively prime to n? Two integers a and b are relatively prime if there are no integers x > 1, y > 0, z > 0 such that a = xy and b = xz. InputThere are several test cases. For each test case, standard inp
        阅读全文
            
摘要:DescriptionTen mathematicians are flying on a balloon over the Pacific ocean. When they are crossing the equator they decide to celebrate this event and open a bottle of champagne. Unfortunately, the cork makes a hole in the balloon. Hydrogen is leaking out and the balloon is descending now. Soon it
        阅读全文
            
摘要:DescriptionWhile skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property: The sum of the digits of that number was equal to the sum of the digits of the prime fact
        阅读全文
            
                    
                
浙公网安备 33010602011771号