UVALive 2145 Lost in Space(暴力)】的更多相关文章

题目并不难,就是暴力,需要注意一下输出形式和精度. #include<iostream> #include<cstdio> #include<cmath> using namespace std; #define maxn 100 #define jd 0.0001 double x[maxn],y[maxn],z[maxn],d,e,f; double getdis(double x,double y,double z,double x1,double y1,doub…
Sheldon Numbers 题目链接: http://acm.hust.edu.cn/vjudge/contest/127406#problem/H Description According to Sheldon Cooper, the best number is 73. In his own words, "The best number is 73. 73 is the 21st prime number. Its mirror, 37, is the 12th, and its m…
The E-pang Palace Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/problem/visitOriginUrl.action?id=217902 Description E-pang Palace was built in Qin dynasty by Emperor Qin Shihuang in Xianyang, Shanxi Province. Itwas the la…
我这个英语学渣又把题给翻译错了……(话说,六级差十分没有过,好心疼T T),题目中说的P和Q都是计算game的个数,我以为是出现的次数,各种wa..后来调整了以后又是各种wa,原来是double型的数据在排序的时候需要注意一下,我们需要给定一个精度,按照一定的规则来进行排序,比如当两个 rate  < eps 的时候,我们判断分母的大小,让分母大或者分子小的优先排序,这样就能尽可能地避免精度问题. 总之,题目不难,暴力枚举就可以,但是想一次AC还是挺难的. 代码如下: #include<ios…
https://cn.vjudge.net/problem/UVALive-6185 我真的是服了orz eps 1e5,1e6过不了 开1e2 1e1都能过 题意:给你一个d阶多项式f的f(0),f(1)...f(d+1),f(d+2) 有一个是错误的,问第几个是错的 题解:题目多给了两个方程(约束). 想了一下如果只给一个,是找不出来的. 给两个的话,可以这么考虑: 先取出一个方程X,再取剩下的n个高斯消元一下,将解得的系数带入最后一个方程,if成立,说明X是错的,else再取另一个(说明错…
题意:求一个x使得 a^x%p = b p为素数: 析:从1开始扫一下就好,扫到p-1就可以了,关键是这个题为什么要用文件尾结束,明明说是0,但是不写就WA... 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath> #incl…
题意:给定一个 10*10的矩阵,每一个W可以跳过一个B向对角走到#并把B吃掉,并且可以一直跳直到不能动为止,现在是W走的时候,问你最多吃几个B. 析:直接暴力+回溯,深搜就好. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include <cmath&g…
[抄题]: Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str. Examples: pattern = "abba", str = "dog cat…
C - Another Brick in the Wall Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UVALive 4425 Description After years as a brick-layer, you've been called upon to analyze the instability of brick walls. The…
题意:给出一个长度在 100 000 以内的正整数序列,大小不超过 10^ 12.求一个连续子序列,使得在所有的连续子序列中, 它们的GCD值乘以它们的长度最大. 析:暴力枚举右端点,然后在枚举左端点时,我们对gcd相同的只保留一个,那就是左端点最小的那个,只有这样才能保证是最大,然后删掉没用的. UVaLive上的数据有问题,比赛时怎么也交不过,后来去别的oj交就过了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000&qu…