Problem DescriptionOn the beaming day of 60th anniversary of NJUST, as a military college which was Second Artillery Academy of Harbin Military Engineering Institute before, queue phalanx is a special...
分类:
其他好文 时间:
2015-04-16 17:47:17
阅读次数:
181
问题描述This English game is a simple English words connection game.
The rules are as follows: there are N English words in a dictionary, and every word has its own weight v. There is a weight if the corre...
分类:
其他好文 时间:
2015-04-16 14:24:45
阅读次数:
185
找给定s集合里面word全部是同一个字符的,这样的word有几个,如果数量#include#include#includeusing namespace std;int main(void){ int t; string a; cin>>t; while(t--) { ...
分类:
其他好文 时间:
2015-04-16 12:04:20
阅读次数:
167
刚开始做这题的时候,以为是简单的动态规划,后来提交之后发现超时了,看到了N可以达到100000,用简单的动态规划,时间复杂度达到了N^2,明显会超时。
想了挺久的,还是不知道怎么做,百度了一下,才知道了原来运用二分搜索,把问题简化成类似排序,时间复杂度为logN,就不会超时了。
下面是AC的代码,看注释可以很容易理解的。如说的有错,欢迎指正。
#include
#include
#i...
分类:
其他好文 时间:
2015-04-15 19:36:33
阅读次数:
92
早上起来头有点疼,突然就想到能不能用kd树解平面最近点对问题,就找了道题试了一下,结果可以,虽然效率不高,但还是AC了~题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1007题目要求平面上最近点对间距离的一半。思路如下:先建立一棵树,所有点插入树中,之...
分类:
其他好文 时间:
2015-04-15 10:51:24
阅读次数:
367
Rain in ACStarTime Limit: 1 SecMemory Limit: 256 MB题目连接http://acm.hust.edu.cn/problem/show/1385DescriptionMaybe you have heard of Super Cow AC who is ...
分类:
其他好文 时间:
2015-04-15 00:51:58
阅读次数:
191
题目大意:
求N!有多少位。1<=N<=10^7。
思路:
N的规模很大。不能直接模拟求位数。先考虑这种做法:
设A = N! = 1*2*3*4*…*N,那么位数就是(int)log10(A) + 1
而(int)log10(A) = log10(1*2*3*…*N) = log10(1) * log10(2) * log10(3) * … * log10(N)
这样累加起来就是结果了。不过因为N是10^7规模的,所以这样累加在HDU上可以AC,但是
POJ上还是超时的。
应该用斯特林公式来做。Sti...
分类:
其他好文 时间:
2015-04-14 19:49:23
阅读次数:
167
感觉是贪心。。。就用了贪心 结果ac了。。
和nyoj236完全一个类型的嘛。。。
#include
#include
int main()
{
int a[3005],visit[3005],n;
while(scanf("%d",&n)!=EOF)
{
if(n==-1)
break;
for(int i=0;i<n;i++)
scanf("%d",&a[i])...
分类:
其他好文 时间:
2015-04-14 16:45:21
阅读次数:
153
目录目录
题目
解题思路
AC SQL题目Write a SQL query to find all duplicate emails in a table named Person.
Id
Email 1
a@b.com
2
c@d.com
3
a@b.com
For example, your query should return the following fo...
分类:
其他好文 时间:
2015-04-14 14:38:54
阅读次数:
154