随笔分类 - 数论
摘要:DescriptionGiven 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x...
阅读全文
摘要: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 #include #inc...
阅读全文
摘要:DescriptionConsider a positive integer X,and let S be the sum of all positive integer divisors of 2004^X. Your job is to determine S modulo 29 (the re...
阅读全文
摘要:DescriptionYou are given a non-negative integern, its decimal representation consists of at most100digits and doesn't contain leading zeroes.Your task...
阅读全文
摘要:Description两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个...
阅读全文
摘要: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...
阅读全文
摘要:给定a,b,c,d, 满足bc>ad, 求使得cn−d⌊abn⌋最小的最小的n.数据规模:1≤a,b,c,d≤1018令y=⌊abx⌋,x=⌈bya⌉, 原问题等价于求cx−dy的最小值,ax≥by,x≥1,y≥0.分两种情况考虑1.a≥b令k=⌊ab⌋,y≥kx,c>ad/b≥kd令a′=a−kb...
阅读全文
摘要:a,b,c三道题有A,B,C三个答案。错排就是这三道题有多少种错误答案。公式:a[i]=(i-1)*(a[i-1]+a[i-2]);a[1]=0;a[2]=1;
阅读全文
摘要:I -Conspiracy Theory and RebrandingTime Limit:1000MSMemory Limit:65536KB64bit IO Format:%I64d & %I64uSubmitStatusPracticeURAL 2032DescriptionToday is ...
阅读全文
摘要:汉诺塔的水题(还没有遇到难的QAQ)一般都是一层层来求!公式:a[i]=a[i-1]*2+1;a[1]=1;a[i]表示从A上把i层移到另一个的步数。
阅读全文
摘要:#include using namespace std;int cmn(int n,int m){ int ans=1; for(int i=1;i>n>>m) { cout<<cmn(n,m)<<endl; } return 0;}View Code
阅读全文

浙公网安备 33010602011771号