随笔分类 -  数论

摘要:Time Limit: 3 secondMemory Limit: 2 MB编写程序,计算n!以十进制数形式表示的数中最右边一个非零数字,并找出在它右边有几个零。 例如:12!=1*2*3*4*5*...*12=479001600计算结果中,数字6是12!以十进制形式表示的数中最右边一个非零数字,它... 阅读全文
posted @ 2017-10-06 19:23 AWCXV 阅读(400) 评论(0) 推荐(0)
摘要:time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Ayrat has number n, represented as i... 阅读全文
posted @ 2017-10-06 19:22 AWCXV 阅读(157) 评论(0) 推荐(0)
摘要:time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Mike has a frog and a flower. His fro... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(126) 评论(0) 推荐(0)
摘要:time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output You are given a non-negative integer... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(402) 评论(0) 推荐(0)
摘要:Problem StatementYou are given four ints: n, k, x, and y. The ints n and k describe a simple undirected graph. The graph has n nodes, numbere... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(137) 评论(0) 推荐(0)
摘要:【题目链接】:http://hihocoder.com/problemset/problem/1493【题意】 【题解】 枚举P从2..n/2 如果P是质数且N-P也是质数; 则输出P和N-P就好; 【完整代码】#include using namespace std;#defi... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(137) 评论(0) 推荐(0)
摘要:【题目链接】:http://www.lydsy.com/JudgeOnline/problem.php?id=1005【题意】 【题解】 题目和题解在上一篇; 这里 对 【(m^(n-2-tot))* (n-2)!】/【(n-2-tot)!* (d[1]-1)!*(d[2]-1)!... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(144) 评论(0) 推荐(0)
摘要:【题目链接】:http://www.lydsy.com/JudgeOnline/problem.php?id=1005【题意】 中文题 【题解】 一棵节点上标有序号的树会和一个prufer数列唯一对应; 这个prufer数列可以这样获得; 每次找到序号最小的叶子节点; 然后把它删... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(239) 评论(0) 推荐(0)
摘要:time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output As behooves any intelligent schoolboy... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(119) 评论(0) 推荐(0)
摘要:time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Mike is a bartender at Rico’s bar. A... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(181) 评论(0) 推荐(0)
摘要:Time Limit: 1 second Memory Limit: 32 MB【问题描述】每个学年的开始,高一新生们都要进行传统的军训。今年有一个军训教官十分奇怪,他为了测试学员们的反应能力,每次吹哨后学员们都会变换位置。每次左数第I位学员都会站到第ai个位置,经过若干次之后,队伍... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(303) 评论(0) 推荐(0)
摘要:time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Bash has set out on a journey to bec... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(86) 评论(0) 推荐(0)
摘要:time limit per test3 seconds memory limit per test256 megabytes inputstandard input outputstandard output Two soldiers are playing a game. At ... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(167) 评论(0) 推荐(0)
摘要:Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4384 Accepted Submission(s): 1733P... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(122) 评论(0) 推荐(0)
摘要:描述 Hanks 博士是 BT (Bio-Tech,生物技术) 领域的知名专家,他的儿子名叫 Hankson。现 在,刚刚放学回家的 Hankson 正在思考一个有趣的问题。 今天在课堂上,老师讲解了如何求两个正整数 c1和 c2 的最大公约数和最小公倍数。现 在 Hankson 认... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(178) 评论(0) 推荐(0)
摘要:【题目链接】:http://www.lydsy.com/JudgeOnline/problem.php?id=1041【题意】 【题解】 由圆的方程可得 X^2+Y^2=R^2 X^2=R^2-Y^2 X^2=(R+Y)(R-Y) 这里令 D = gcd(R+Y,R-Y); 则 g... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(154) 评论(0) 推荐(0)
摘要:Time Limit: 1 second Memory Limit: 128 MB【问题描述】Hanks博士是BT(Bio-Tech,生物技术)领域的知名专家。现在,他正在为一个细胞实验做准备工作:培养细胞样本。Hanks博士手里现在有N种细胞,编号从1~N,一个第i种细胞经过1秒钟... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(200) 评论(0) 推荐(0)
摘要:【题目链接】:http://codeforces.com/contest/776/problem/B【题意】 给你n个物品, 第i个物品价值为i+1 让你给这n个物品着色; 如果a物品的价值x和b物品的价值y 满足x是y的因子且x是质数; 则x和y的颜色不能一样; 求最小使用颜色数... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(181) 评论(0) 推荐(0)
摘要:【链接】h在这里写链接【题意】给你n个数,a1,a2,……,an,两人轮流从中改数,每次选一个素数p和一个正整数k,将a1到an中所有可以被p^k整除的数除p^k。当玩家在他的回合把所有数都变成1后,该玩家就赢了。【题解】每个素数的游戏都是独立的。比如2 3 4p=2的游戏和p=3的游戏。会发现是独... 阅读全文
posted @ 2017-10-04 18:44 AWCXV 阅读(116) 评论(0) 推荐(0)
摘要:【链接】点击打开链接【题意】让你选择n个数字,组成一个数组,使得这n个数字中恰好有k对,它们是互质的。【题解】我们可以先找出前n个质数,那么接下来的问题就转化为,凑出rest = n*(n-1)/2-k对不互质的数来.我们先找出最大的t,且满足t*(t-1)/2 #include #include ... 阅读全文
posted @ 2017-10-04 18:44 AWCXV 阅读(109) 评论(0) 推荐(0)