文章列表
 
您正在查看 "杭州电子科大acm" 分类下的文章

2010-02-28 22:46

http://acm.hdu.edu.cn/showproblem.php?pid=3290

比赛解决题报告:


题目描述给出一棵“树”,其实质是图,要求通过花费最小去掉多余的边,即求最“大”生成树(题目可确保只存在唯一可能性),再根据动态增删节点上的果实,按"Q"操作求出以给出节点为根的子树上的果实数,可用树状数组或线段树实现。

根据这个报告我写了代码,可是一直RE。找也找不出原因,找了个代码,改了改才AC,也不知道原来的为什

 
2009-10-16 21:27

//其实就是最小生成树问题。不过编辑错误了好几次,求两点之间的距离我用的distance,一直编辑错误,这个单词可能是关键字吧。以后小心。

#include<iostream>
#include<cmath>
using namespace std;
const int m=101;
struct p
{
double x, y;
} point[m];
int n;
double g[m][m];

double dis( struct p p0, struct p p1)
{
r

 
2009-10-09 17:18

http://acm.hdu.edu.cn/showproblem.php?pid=1208

先BS一下自己,WA了N次,郁闷。把can数组类型改为_int64之后,返回值没有改,这里就一直WAWA啊。我用的DFS,再加记忆化搜索,DP也可以。

#include<iostream>
using namespace std;

const int size=35;
int m

 
2009-10-07 14:58

// 第一次做,优化了几次,还是超时。在网上找到了个思路才AC,还有一个问题,就是找的时候。一个数可能有两种不同的删除法来得到同一个N,比如说 5116,可以删除第二个1或第三个1得到5632,所以在输出的时候相同的一个只能输出一次,这里WA了两次。

这样做,可以假想剔掉了A的第i位得到B,那么

A = ap a(p-1) ... a(i+1)   ai      a(i-1) a(i-2) ... a1 a0

B =   

 
2009-10-07 2:08

http://acm.hdu.edu.cn/showproblem.php?pid=1240

//感觉用深搜应该能过,我用的广搜

#include<iostream>
#include<queue>
typedef struct
{
int x, y, z ;
int step;
}node;

using namespace std;

 
2009-10-06 23:42

http://acm.hdu.edu.cn/showproblem.php?pid=1180

//精典的BFS改进过来的。要处理的一些情况,当扩展到当前节点为‘|’可‘-’的时候就要展开讨论,讨论是水平过来的还是竖直过来的,处理不同的情况。

my code:

#include<iostream>
#include

 
2009-09-29 16:54

http://acm.hdu.edu.cn/showproblem.php?pid=1027

my code:

#include<iostream>

#include<algorithm>

using namespace std;

int main()
{
int m, n,

 
2009-09-29 16:11

http://acm.hdu.edu.cn/showproblem.php?pid=1312

#include<iostream>
#include<queue>
#include<string>
using namespace std;
typedef struct
{
int x, y;
}point;

const int SIZE=20;

int w, h;

 
2009-09-29 14:14

http://acm.hdu.edu.cn/showproblem.php?pid=1253

my code:

#include<stdio.h>

#include<string.h>

#include<iostream>

#include<queue>

 
2009-09-29 12:03

http://acm.hdu.edu.cn/showproblem.php?pid=1072

//第一次看到这道题。第一反应想到了用深搜。可是每个点可以重复走。深搜好像不行。

又想到了广搜。一般广搜加入队要判断一个点是否已经走了。这道题显然不能这样记录。后来网上搜了一下。就做一点判断就行了。于是做了一下,前两交时间超出,就一个问题。改了一下就AC了

 
2009-09-28 22:13

http://acm.hdu.edu.cn/showproblem.php?pid=1026

//第一次用深搜。超时,当时对广搜不是很了解,后来学了一下广搜,一下AC,感觉真好

#include<stdio.h>
#include<string.h>

const int SIZE=200;

char map[SIZE][SIZE];

 
2009-09-28 12:56

http://acm.hdu.edu.cn/showproblem.php?pid=1242

//用数组作队列进行插入和删除

#include<iostream>
using namespace std;
struct point{
int x;
int y;
int t;
}p[205];

const int size=201;

 
2009-09-27 10:55

http://acm.hdu.edu.cn/showproblem.php?pid=1241

求最大连通图的深度优先搜索,过程也很简单。记录一下搜索过和节点就OK了。

#include<iostream>

using namespace std;

const int size=101;

char grid[size][

 
2009-09-24 23:13

http://acm.hdu.edu.cn/showproblem.php?pid=2048

N张票的所有排列可能自然是Ann = N!种排列方式
现在的问题就是N张票的错排方式有几种。
首先我们考虑,如果前面N-1个人拿的都不是自己的票,即前N-1个人满足错排,现在又来了一个人,他手里拿的是自己的票。
只要他把自己的票与其他N-1个人中的任意一个交换,就可以满足N个人的错排。

 
2009-09-24 13:10

http://acm.hdu.edu.cn/showproblem.php?pid=2053

#include<iostream>
#include<cmath>
using namespace std;
void main()
{
double n;
    while(cin>>n)
   cout<<((int)sqrt(n)*(int)sqrt(n)==(int)n?1:0)<<endl;
}

 
   
 
 
文章存档
 
     
 
最新文章评论
  

条理很清晰
 

什么是多重队列?跪求!!!
 

orz ...
 

请问这个代码,错在什么地方了?一直是 running time error 我是不是少考虑了什么条
 

#include<iostream> #include<algorithm> #include<string.h> using namespace std;
   
帮助中心 | 空间客服 | 投诉中心 | 空间协议
©2012 Baidu