随笔分类 -  数论

摘要:Time Limit: 3 secondMemory Limit: 2 MB【问题描述】一个数可以分解成其质因子的乘积.如24=2*2*2*3,26=2*13;100=2*2*5*5。现要你输入一个整数,求出它的质因子。【输入】共一行。内容是所要求解的整数 【输出】一行。输出分解的结果【输入样例】1... 阅读全文
posted @ 2017-10-06 19:23 AWCXV 阅读(285) 评论(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 阅读(156) 评论(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 阅读(115) 评论(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 阅读(165) 评论(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 阅读(178) 评论(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 阅读(120) 评论(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 阅读(121) 评论(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 阅读(399) 评论(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 阅读(136) 评论(0) 推荐(0)
摘要:描述 Hanks 博士是 BT (Bio-Tech,生物技术) 领域的知名专家,他的儿子名叫 Hankson。现 在,刚刚放学回家的 Hankson 正在思考一个有趣的问题。 今天在课堂上,老师讲解了如何求两个正整数 c1和 c2 的最大公约数和最小公倍数。现 在 Hankson 认... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(177) 评论(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 阅读(133) 评论(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 阅读(150) 评论(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 阅读(198) 评论(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)
摘要:【题目链接】: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 阅读(142) 评论(0) 推荐(0)
摘要:【题目链接】:http://www.lydsy.com/JudgeOnline/problem.php?id=1005【题意】 中文题 【题解】 一棵节点上标有序号的树会和一个prufer数列唯一对应; 这个prufer数列可以这样获得; 每次找到序号最小的叶子节点; 然后把它删... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(236) 评论(0) 推荐(0)
摘要:Time Limit: 1 second Memory Limit: 32 MB【问题描述】每个学年的开始,高一新生们都要进行传统的军训。今年有一个军训教官十分奇怪,他为了测试学员们的反应能力,每次吹哨后学员们都会变换位置。每次左数第I位学员都会站到第ai个位置,经过若干次之后,队伍... 阅读全文
posted @ 2017-10-04 18:45 AWCXV 阅读(296) 评论(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)
摘要:【链接】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 阅读(113) 评论(0) 推荐(0)
摘要:【链接】h在这里写链接【题意】定义bad list是一个非空的、最大公约数为1的序列。给定一个序列,有两种操作:花费x将一个元素删除、花费y将一个元素加1,问你将这个序列变为good list所需要的最小花费是多少。【题解】枚举gcd为i.这里的枚举,并不是说确切这些数字的gcd就是i;而是枚举这些... 阅读全文
posted @ 2017-10-04 18:44 AWCXV 阅读(178) 评论(0) 推荐(0)