随笔分类 -  数论

摘要:#1768 : 真正的素数 时间限制:20000ms 单点时限:1000ms 内存限制:256MB 描述 一个数 w 被称为真正的素数,当且仅当对于任何非负整数 x,y (x+y<d(w)),将十进制表示下的 w 的前 x 位和后 y 位去掉后它仍然是个素数。其中 d(w) 表示 w 在十进制表示下 阅读全文
posted @ 2018-08-30 16:31 ACRykl 阅读(208) 评论(0) 推荐(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 阅读全文
posted @ 2018-04-08 23:04 ACRykl 阅读(229) 评论(0) 推荐(0)
摘要:A/B Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7509 Accepted Submission(s): 5969 Problem Des 阅读全文
posted @ 2018-04-07 22:34 ACRykl 阅读(144) 评论(0) 推荐(0)
摘要:给出两个整数a,b 扩展欧几里得可以求出gcd(a,b),并且能顺带算出一组特解(x,y), 使ax+by=gcd(a,b)。 其实扩展欧几里得算法就是收集辗转相除法中产生的式子,倒回去,可以得到ax+by=gcd(a,b)的整数解。 原理如下: 设a=r0,b=r1, 那么根据辗转相除法, r0= 阅读全文
posted @ 2018-04-07 20:22 ACRykl 阅读(227) 评论(1) 推荐(0)
摘要:#1530 : 分数取模 时间限制:1000ms 单点时限:10000ms 内存限制:256MB 描述 给定三个正整数 a、 b 和 p,满足 b 和 p 互质。这时分数 a / b 除以 p 的余数,即 a / b MOD p 可以定义为 a × b-1 MOD p。 其中b-1 是 b 的逆元, 阅读全文
posted @ 2018-04-06 22:40 ACRykl 阅读(501) 评论(0) 推荐(0)
摘要:The sum problem Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 29632 Accepted Submission(s): 888 阅读全文
posted @ 2018-04-05 20:14 ACRykl 阅读(101) 评论(0) 推荐(0)
摘要:链接:https://www.nowcoder.com/acm/contest/82/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 时间限制:C/C++ 1秒,其他语言2秒 空间限制 阅读全文
posted @ 2018-03-31 14:18 ACRykl 阅读(538) 评论(0) 推荐(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 阅读全文
posted @ 2018-03-30 18:30 ACRykl 阅读(194) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-03-28 23:03 ACRykl 阅读(282) 评论(0) 推荐(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. 阅读全文
posted @ 2018-03-28 22:41 ACRykl 阅读(156) 评论(0) 推荐(0)
摘要:Prime Distance Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20709 Accepted: 5563 Description The branch of mathematics called number the 阅读全文
posted @ 2018-03-26 22:11 ACRykl 阅读(117) 评论(0) 推荐(0)
摘要:Help Hanzo Amakusa, the evil spiritual leader has captured the beautiful princess Nakururu. The reason behind this is he had a little problem with Han 阅读全文
posted @ 2018-03-26 21:28 ACRykl 阅读(137) 评论(0) 推荐(0)
摘要:链接:https://www.nowcoder.com/acm/contest/90/L来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C 阅读全文
posted @ 2018-03-24 22:28 ACRykl 阅读(350) 评论(0) 推荐(0)
摘要:链接:https://www.nowcoder.com/acm/contest/90/F来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C 阅读全文
posted @ 2018-03-24 22:15 ACRykl 阅读(189) 评论(0) 推荐(0)
摘要:分析:题目给出一个公式f(n)=n*n+n+41,输入a和b,0<=a<=b<=10000, 问在区间[a,b]中满足f(k)是素数的数所占的百分比。 b的范围不大,直接暴力素数打表即可。 最后输出保留两位小数,卡精度,必须在结果加上1e-5(或者更小)保证精度。 例如,输入 6000 9999,不 阅读全文
posted @ 2018-03-22 21:33 ACRykl 阅读(182) 评论(0) 推荐(0)
摘要:We all know the Super Powers of this world and how they manage to get advantages in political warfare or even in other sectors. But this is not a poli 阅读全文
posted @ 2018-03-22 20:31 ACRykl 阅读(292) 评论(0) 推荐(0)
摘要:You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N. For e 阅读全文
posted @ 2018-03-21 22:05 ACRykl 阅读(120) 评论(0) 推荐(0)
摘要:Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only i 阅读全文
posted @ 2018-03-21 21:23 ACRykl 阅读(159) 评论(0) 推荐(0)
摘要:Farey Sequence Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 17894 Accepted: 7179 Description The Farey Sequence Fn for any integer n wit 阅读全文
posted @ 2018-03-20 23:09 ACRykl 阅读(148) 评论(0) 推荐(0)
摘要:Sigma Function Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes 阅读全文
posted @ 2018-03-20 22:44 ACRykl 阅读(192) 评论(0) 推荐(0)