The Unsolvable Problem】的更多相关文章

The Unsolvable Problem 题目链接:http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=45783 题意: 给定一个整数n(2 < = x < = 10^9),我们应该找到一双正整数a,b,满足a + b = n和a,b的最小公倍数是尽可能大: 输出这个最大的最小公倍数. 题目要求要T组案例. 案例: Sampl Input 3 2 3 4 Sample Output 1 2 3 解题思路: 由于2&…
Problem Description There are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number. Given an integer n(2 <= n <= 109).We should find a pair of positive integer a, b so that a + b = n and [a…
2013-07-30 20:35 388人阅读 评论(0) 收藏 举报 http://acm.hdu.edu.cn/showproblem.php?pid=4627 The Unsolvable Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 230    Accepted Submission(s): 136 Prob…
链接: http://acm.hdu.edu.cn/showproblem.php?pid=4627 The Unsolvable Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 243    Accepted Submission(s): 143 Problem Description There are many u…
题目链接:http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82974#problem/E 解题思路:数论,从一个数的中间开始往两边找,找到两个互质的数就是,若这个数为奇数,则就是(n/2)*(n-n/2),若这个数是偶数,则还需要判断这个数的一半是否是偶数,若是偶数,则就是(n/2+1)*(n/2-1),若是奇数,则就是(n/2+2)*(n/2-2) 程序代码: #include <iostream> #define l long l…
http://acm.hdu.edu.cn/showproblem.php?pid=4627 分类讨论一下就可以 代码: #include<iostream> #include<cstdio> #include<algorithm> #include<string> #include<cstring> #include<cmath> #include<set> using namespace std; typedef lo…
给你一个数 n ( 2 <= n <= 109 ),现在需要你找到一对数a, b (a + b = n),并且使得LCM(a, b)尽可能的大,然后输出最大的 LCM(a, b). (为什么我每次看到题目都想去暴力..Orz    题外话) 这道题先对  n = 2 的情况进行判断,从输出可以知道 n =  2 的时候 ans =  1.接着对 n 进行分情况讨论.当 n = 2k + 1 的时候,ans = k * (k + 1). 当 n = 2k 的时候: 当 k 为偶数的时候 ans…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4627 对n除个2,然后考虑下奇偶... //STATUS:C++_AC_15MS_228KB #include <functional> #include <algorithm> #include <iostream> //#include <ext/rope> #include <fstream> #include <sstream>…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4627 题目大意:给定一个整数n(2 <= n <= 109),满足a+b=n并且[a,b]的最小公倍数最大. 分析:相当简单的的一道题,因为生病好久没做题目,杭电居然是要用__int64,用long long反而错误,为此,WA了无数遍 代码如下: # include<iostream> # include<cstdio> # include<cmath> us…
题意描述:给出一个n,要求在所有满足n = a+b的a和b里面求a和b的最小公倍数最大的两个数的最小公倍数. 解题报告:比赛的时候看到这个题的第一反应就是寻找这两个数一定是在a和b比较接近的地方找,这样才能保证a和b的最小公倍数最大,首先,奇数和偶数是一定要分开的讨论的,因为奇数和偶数的一半是不同的,奇数的一半可能就是所要的结果,但是偶数的一半可以确定一定不是所要的结果,因为偶数一半刚好a和b就相等了,最小公倍数就是他们本身了,这是最小的了,然后偶数里面又要分开讨论,一种是这个偶数的一半是奇数,…
题意:给一个数n,找一个正整数x<n,使得x和n-x的最小公倍数最大. 思路:显然x和n-x越接近越好,gcd必须为1(贪心).从大到小考虑x,如果n为奇数,则答案就是x=n/2,如果n为偶数,令n=2k,如果k为奇数,且大于1则x=k-2否则x=k,如果k为偶数则x=k-1.以上结论基于以下两个事实: (1)相邻两个数的gcd为1 (2)相邻两个奇数的gcd为1 (3)1和1的gcd为1 写的时候没用到这些事实,直接从n/2向下枚举,当gcd为1时得到答案 1 2 3 4 5 6 7 8 9…
HDU 4622 Reincarnation 枚举字符串的起点,构造后缀自动机,每次插入一个字符,就能统计得到当前不同字串的个数,预处理出所有的询问. #include<cstdio> #include<cstring> #define MAXN 2010 #define MAXM 26 int res[MAXN][MAXN]; char str[MAXN]; struct node { node *next[MAXM]; node *pre; int step; int tot;…
Description There are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number. Given an integer n(2 <= n <= 10 9).We should find a pair of positive integer a, b so that a + b = n and [a, b] is…
今天悲剧了,各种被虐啊,还是太年轻了 Crime 这道题目给的时间好长,第一次就想到了暴力,结果华丽丽的TLE了. 后来找了一下,发现前24个是1, 2, 6, 12, 72, 72, 864, 1728, 13824, 22032, 555264, 476928, 17625600, 29599488, 321115392, 805146624, 46097049600, 36481536000, 2754120268800, 3661604352000, 83905105305600, 19…
HDU 4627 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Description There are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number. Given an integer n(2 <=…
Description There are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number. Given an integer n(2 <= n <= 10 9).We should find a pair of positive integer a, b so that a + b = n and [a, b] is…
原文 Be healthier and happier by spending time in the sun In the dead of winter,we don't typically think about spending time outside,but according to many medical experts,we should. The sun is our greatest source of a vitamin that is essential for good…
网址: https://www.spinellis.gr/cscout/ https://www2.dmst.aueb.gr/dds/cscout/index.html https://github.com/dspinellis/cscout 还有一个工具叫Xrefactory,它可以分析c++程序. cscout只能分析c程序.具体如下: A tool adopting an approach similar to ours is Vittek's Xrefactory [59]. Its f…
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=36  The 3n + 1 problem  Background Problems in Computer Science are often classified as belonging to a certain class of problem…
The 3n + 1 problem Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 53927   Accepted: 17142 Description Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In th…
 The 3n + 1 problem  Background Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is…
这是一道很坑爹的题,一定注意输入的两个数的大小,并且不能简单的交换,因为在最后的输出的时候还需要将原来的数按照原来的顺序和大小,这就是为什么还得开辟两个值得原因 Description Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be…
 The 3n + 1 problem  Background Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is…
1.链接地址: http://bailian.openjudge.cn/practice/1207/ http://poj.org/problem?id=1207 2.题目: 总时间限制: 1000ms 内存限制: 65536kB 描述 Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In…
Description Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is not known for all po…
F - Eight Puzzle Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Java/Others) Submit Status The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sli…
这个问题并计算质数了一下相间隔似的.思想上一致. 注意问题: 1 i 可能 大于或等于j -- 这里上传.小心阅读题意,我没有说这个地方不能保证.需要特殊处理 2 计算过程中可能溢出,的整数大于最大值,需要使用long long 关于效率和时间问题: 1 能够使用数组保存中间结果,这样执行快了.内存消耗大了, 2 能够不使用中间数组. 这样执行肯定比較慢了.可是内存消耗小,一样能够AC的. 全部没有个标准吧.看情况而定.假设须要速度就添加数组,假设省内存就不使用数组吧. 这样的题目一般都使用数组…
新手发帖,很多方面都是刚入门,有错误的地方请大家见谅,欢迎批评指正  The 3n + 1 problem  Background Problems in Computer Science are often classified as belonging to acertain class of problems (e.g., NP, Unsolvable, Recursive). In thisproblem you will be analyzing a property of an al…
The 3n + 1 problem Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 32   Accepted Submission(s) : 15 Problem Description Problems in Computer Science are often classified as belonging to a certain…
Description Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is not known for all po…