标签:Life 5000 Universe 42545 solution xx each find out
Problem Description
For decades, scientists have wondered whether each of the numbers from 0 to 100 could be represented as the sum of three cubes, where a cube is the same number multiplied together three times.
42 was the last number without a proven solution — until now.
The solution is (−80538738812075974)3+804357581458175153+126021232973356313=42
Now, Yen-Jen is suspicious of the existence of other solutions. But, the solutions are not so trivial to find out.
Yen-Jen wants to find out easysolutions first. That is, for the equation a3+b3+c3=xYen-Jen wants to find out at least one solution for each integer xx in [0,200],where |a|,|b|,|c|≤5000.
Since Yen-Jen is still busy preparing the test data of some(this?) problem, pleasehelp him find out at least one solution for each xx or tell him that thesolution doesn't exist when |a|,|b|,|c|≤5000.
Input
The first line contains an integer TT indicating the number of xx to bechecked.Following TT lines each contains one integer xx.
- 1≤T≤10
- 0≤x≤200
Output
For each test case, output one line containing three space-separated integers a,b,ca,b,c such that a3+b3+c3=x and |a|,|b|,|c|≤5000. If thesolution doesn't exist, output impossible
.
Sample Input
2 1 2
Sample Output
1 1 -1 1 1 0
这道题的答案范围x是0~200。但是需要枚举3个变量a,b,c且每个范围都是-5000~5000.
因此不管是什么方法应该TLE是跑不了(没错这竟然是一道不打表过不了的题(应该吧))
注意5000的3次还需要用到long long。
然后a,b,c三个变量的关系要么3正,要么2正1负要么1正2负。(不过3正好像也可以去掉……因为包含其中了?)
具体代码看这位大佬的吧qwq(里面有unordered_map和文件freopen)
标签:Life,5000,Universe,42545,solution,xx,each,find,out 来源: https://www.cnblogs.com/mikku39/p/14386464.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。