E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
杭电OJ1789
POJ
1789
-Truck History .
转载请注明出处:優YoU http://user.qzone.qq.com/289065406/blog/1299323607 题意大概是这样的:用一个7位的string代表一个编号,两个编号之间的distance代表这两个编号之间不同字母的个数。一个编号只能由另一个编号“衍生”出来,代价是这两个编号之间相应的distance,现在要找
·
2015-11-13 10:55
history
从HD OJ 1005想到的
杭电OJ
[1005](http://acm.hdu.edu.cn/showproblem.php?
·
2015-11-13 09:43
OJ
POJ
1789
Truck History
最小生成树问题。 给你一组字母序列,问你最有可能的演变,也就是把全部的序列连通所花费最小。 每次派生的花费 取决于两个字符串上 不同的字母个数。 于是两两算出花费,然后Kruskal算最小。 #include<cstdio> #include<cstring> #include<string> #include<queue>
·
2015-11-13 08:10
history
杭电OJ
_DIY_YTW2_1001 A Mathematical Curiosity
Problem Description Given two integers n and m, count the number of pairs of integers (a,b) such that 0 < a < b < n and (a^2+b^2 +m)/(ab) is an integer. This problem contains multiple te
·
2015-11-13 07:38
Math
解题报告 HDU
1789
Doing Homework again
Doing Homework again Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Description Ignatius has just come ba
·
2015-11-13 04:34
home
杭电OJ
——1007 Quoit Design(最近点对问题)
Quoit Design Problem Description Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded. In the fiel
·
2015-11-13 04:51
design
hdu
1789
代码如下: #include"stdio.h" #include"string.h" #include"stdlib.h" int flag[1005]; struct node { int date,score; }x[1005]; int cmp(const void *a,const void *
·
2015-11-13 03:30
HDU
[POJ
1789
Truck History]
[题目来源]:CTU Open 2003 [关键字]:图论 [题目大意]:给出一个n*7的字母矩阵,每一行代表一种车,那么定义的每种车之间的距离为七个位置上每个相应的位置上不同字母数的和,要求的是不同种车的距离的和得最小值。 //==================================================================================
·
2015-11-13 02:29
history
杭电OJ
—— 1084 What Is Your Grade?
What Is Your Grade? Problem Description “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points c
·
2015-11-13 01:42
you
POJ
1789
, Truck History
Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5256 Accepted: 1851 DescriptionAdvanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for v
·
2015-11-13 01:58
history
POJ
1789
Truck History
将字符串0到n编号,然后建图。G[i][j] 是边的权值等于两个字符串的差异。然后求出最小生成树的权 值。第一次写堆优化的prim算法,堆优化的好处在于避免重复更新已经存在在生成树中的点的值, 在n比较大的时候效果会很明显。 /*Accepted 16128K 610MS C++ 1519B 2012-07-24 10:34:28*/
·
2015-11-13 01:15
history
Truck History
id=
1789
#include<cstdio> #include<cstring> #include<algorithm> #define MAXN
·
2015-11-12 23:44
history
HDU
1789
Doing Homework again
pid=
1789
贪心,按价值从大到小排序,然后尽可能的安排到截止时间 View Code #include <stdio.h> #include <stdlib.h&
·
2015-11-12 21:43
home
杭电oj
1326 Box of Bricks
Tips:先求出平均数再分别计算各数与平均数的差相加,注意两个测试结果之间要空一行 1 #include<iostream> 2 using namespace std; 3 int main() 4 { 5 int T,count=0; 6 while(cin>>T) 7 { 8 i
·
2015-11-12 21:17
杭电
zoj
1789
The Suspects
这道题是并查集的题,写过这道题之后,我明白了一点,就是从根上改变所属father域 #include<stdio.h> #include<stdlib.h> #include<string.h> #include<math.h> int p[30000+100]; int a[30000+100]; int find(int x
·
2015-11-12 20:50
ZOJ
杭电oj
2037 今年暑假不AC
Tips:贪心算法的典型应用,可以按照节目结束时间由小到大排序,(至于结束时间相同的,有些人说按开始时间早的排序,不过个人认为不必处理,因为结束时间一样,两个之中要么都没有,要么必有一个)然后再依次进行判断看是否能加入到结果集中。 1 /**贪心算法,按节目结束时间排序*/ 2 #include<iostream> 3 using namespace st
·
2015-11-12 18:12
杭电
杭电oj
1009 FatMouse' Trade
Tips:本题采用贪心算法,类似于背包问题,关键在于读入数据之后,将数据按 J[i]/F[i] 从大到小排列即可。 1 /**本程序主要采用贪心算法思想,类似于背包问题*/ 2 #include<stdio.h> 3 #include<string.h> 4 int main() 5 { 6 int M,N;
·
2015-11-12 18:12
杭电
杭电oj
3079 Vowel Counting
Tips:可以先将输入的字符串全部转化为小写字母,然后再将元音字母变为大写,时间复杂度O(n) 1 #include<stdio.h> 2 #include<string.h> 3 #include<ctype.h> 4 int main() 5 { 6 int T; 7 scanf("%d
·
2015-11-12 18:11
count
杭电oj
1219 AC Me
Tips:本题中,输入字符串之后,直接从头到尾处理一遍,调用函数判断是否是字母,不要自己写循环判断是否为字母,易超时! 不过本题中有一个疑问,自己最开始用C写的,一直是Time Limit Exceeded ,但使用C++写之后就AC了 1 #include <iostream> 2 #include <string> 3 #include <stri
·
2015-11-12 18:10
杭电
杭电oj
3361
Tips:字符在计算机中都是以ASCII码形式保存,直接以char形式输出ASCII码即可。 1 #include<stdio.h> 2 int main() 3 { 4 int T; 5 scanf("%d",&T); 6 int a[T]; 7 for(int i = 0;i
·
2015-11-12 18:10
杭电
杭电oj
1328
Tips:本题中没有任何难度,直接按普通逻辑进行计算即可。 1 #include<stdio.h> 2 #include<string.h> 3 char ch[26]={'A','B','C','D','E','F','G', 4 'H','I','J','K','L','M','N', 5
·
2015-11-12 18:09
杭电
杭电oj
2095 & 异或^符号在C/C++中的使用
异或^符号,在平时的学习时可能遇到的不多,不过有时使用得当可以发挥意想不到的结果。 值得注意的是,异或运算是建立在二进制基础上的,所有运算过程都是按位异或(即相同为0,不同为1,也称模二加),得到最终结果。 特点:任何数和0异或都等于它本身;两个相同的数异或后的结果是0; 举例如下: int a = 4 =100(二进制) int b = 3 =011(二进制) int c = a^b
·
2015-11-12 18:08
c/c++
杭电oj
2719
Tips:本程序没有什么难度,只要按照逻辑进行替换即可,需要注意的是,由于输入串中含有空格符号,所以不能使用scanf("%s",ch);来读取一串,可以使用gets()函数读取一行字符。 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5
·
2015-11-12 18:08
杭电
杭电oj
1062 Text Reverse
Tips:使用一个临时数组c[1000] ,将输入的数据一边复制一边处理,碰到空格时就将前面的字符反向输出即可 1 #include<stdio.h> 2 #include<string.h> 3 ///使用一个临时数组c[1000] ,将输入的数据一边复制一边处理 4 void reverse(char s[]){ 5 cha
·
2015-11-12 18:07
text
Truck History---poj
1789
id=
1789
题意: They defined the distance of truck types as the number of positions with different
·
2015-11-12 15:00
history
poj
1789
Truck History
prim求最小生成树。 1 #include<stdio.h> 2 #include<string.h> 3 #define INF 100000000 4 #define MAXN 2100 5 6 int n, v[MAXN], low[MAXN], d[MAXN][MAXN]; 7 char s[MAXN][10]; 8 9
·
2015-11-12 15:08
history
POJ题目分类
1753 2965贪心:1328 2109 2586构造:3295模拟:1068 2632 1573 2993 2996图:最短路径:1860 3259 1062 2253 1125 2240最小生成树:
1789
·
2015-11-12 12:45
poj
[HDU
1789
] Doing Homework again
Doing Homework again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6925 Accepted Submission(s): 41
·
2015-11-12 12:23
home
JS拖动层的实现,3721拖动层,导航拖动
http://hi.baidu.com/sunhc2001/blog/item/8ded32d0846c
1789
a1ec9c25.html 解决思路
·
2015-11-12 12:21
js
ytu
1789
:n皇后问题(水题,枚举)
n皇后问题 Time Limit: 1 Sec Memory Limit: 64 MB Special Judge Submit: 12 Solved: 3 [ Submit][ Status][ Web Board] Description 在n&time
·
2015-11-12 10:13
枚举
poj
1789
Doing Homework again
思路:找到当前所给延时最长的所包含的作业里面分数最大的完成它,eg: 7 1 4 6 4 2 4 3 3 2 1 7 6 5 4当我在第7天的时候,没有延时 >=7 的,所以没有满嘴条件的,当在第6天的时候, 只可能完成一个作业就是1,完成它。第5天的时候可以完成延时为6的那个作业,但是第六天已经完成了,所以没有满足要求的,第四天的时候有四个满足要求的,一个延时为 6 三个延时为 4,
·
2015-11-12 10:21
home
poj
1789
Truck History(简单最小生成树)
id=
1789
模板题 题意是一个字符串跟一个字符不同的字符串有多少 这个数量就相当于权值 连起来最小 View Code 1 #include <iostream> 2
·
2015-11-12 09:52
history
HDU
1789
Doing Homework again (贪心)
Doing Homework again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6499 Accepted Submission
·
2015-11-11 18:09
home
poj
1789
Truck History
花了好长时间去理解题意,看来英语阅读能力还有待提高。 题意大概是这样的:用一个7位的string代表一个编号,两个编号之间的distance代表这两个编号之间不同字母的个数。一个编号只能由另一个编号“衍生”出来,代价是这两个编号之间相应的distance,现在要找出一个“衍生”方案,使得总代价最小,也就是distance之和最小。 例如有如下4个编号: aaaaaaa baaaaaa
·
2015-11-11 17:11
history
hdu
1789
doing homework again(贪心)
pid=
1789
题意: 每个老师都会给出交作业的期限和没按时交会扣掉的分数 要求出扣除最少分数的情况 思路: 是一题典型的贪心把扣除分数多的科目排在前面 并排在尽量晚的位置
·
2015-11-11 16:18
home
hdu
1789
Doing Homework again (贪心)
Doing Homework again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 4762 Accepted Submission(s)
·
2015-11-11 15:52
home
POJ
1789
题
//重点理解:关键抽象成最小生成树问题及二维字符串数组的使用#include <stdio.h>#include <string.h>#define arraysize 2001char truck[arraysize][8]; //定义字符串二维数组int dis[arraysize][arraysize];bool final[arraysize];int d
·
2015-11-11 15:23
poj
hdu 1251 赤裸裸的Trie树
在网吧做题,赶上
杭电OJ
不能交题,先把代码存在博客里,回学校提交,有错再改。
·
2015-11-11 15:11
trie
Kuskal/Prim POJ
1789
Truck History
题目传送门 1 /* 2 题意:给出n个长度为7的字符串,一个字符串到另一个的距离为不同的字符数,问所有连通的最小代价是多少 3 Kuskal/Prim: 先用并查集做,简单好写,然而效率并不高,稠密图应该用Prim。这是最小生成数的裸题,然而题目有点坑爹:( 4 */ 5 #include <cstdio> 6 #include <cstri
·
2015-11-11 12:21
history
hdu5073 简单枚举+精度处理
我是在
杭电oj
题目重现的比赛上做这题,因为之前听人说现场赛时有人用n^2的算法蹭过了,所以我不断蹭,蹭了一个小时都没蹭过。。。~!
·
2015-11-11 10:01
HDU
hdu 2807 矩阵运算+最短路
想了一下,觉得优化的矩阵运算不好打,就直接打了个最简单的,AC了,可见
杭电OJ
的测试数据还是很弱的。
·
2015-11-11 10:15
HDU
POJ
1789
Truck History
题意 : 说实话,题意我没看懂,后来让人给我讲的样例。。。。。 4 aaaaaaa baaaaaa abaaaaa aabaaaa 0 这个样例的话,就是输入n下面n行,每行7个字母,让你依次选两行进行比较,不同的有多少个,所以题目中给的样例,1,2行一个不同的,1,3行一个不同的,1,4行一个不同的,所以距离是3,2,3行两个不同的,2,1行一个不同的,2
·
2015-11-11 10:55
history
POJ
1789
&ZOJ2158--Truck History【最小生成树变形】
id=
1789
题意:卡车公司有悠久的历史,它的每一种卡车都有一个唯一的字符串来表示,长度为7,它的全部卡车(除了第一辆)都是由曾经的卡车派生出来的。
·
2015-11-11 08:00
history
Java reflection
http://www.journaldev.com/
1789
/java-reflection-tutorial-for-classes-methods-fields-constructors-annotations-and-much-more
·
2015-11-11 08:29
reflection
贪心-hdu-
1789
-Doing Homework again
pid=
1789
题目意思: 有n个作业,每个作业有一个截止日期,每个作业如果超过截止日期完成的时候有一个惩罚值,问怎样安排作业,使惩罚值最小。 解题思路: 贪心。
·
2015-11-11 08:54
home
HDOJ HDU
1789
Doing Homework again ACM
1789
IN HDU
pid=
1789
一道很标准的贪心题 直接贴代码: //MiYu原创, 转帖请注明 : 转载自&n
·
2015-11-11 07:21
home
淘宝数据魔方读后感
原文见:http://www.tbdata.org/archives/
1789
1. 1500台机器,40000个job,每日1.5P数据量; 2.
·
2015-11-11 04:08
读后感
POJ
1789
Truck History
解题思路:prim算法求解最小生成树 #include < iostream > using namespace std; #define MaxNum 1e8 inline int distance( char * a, ch
·
2015-11-11 04:03
history
POJ
1789
Truck History
&n
·
2015-11-11 00:54
history
HDU
1789
Doing Homework again (贪心)
Doing Homework again Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Practic
·
2015-11-11 00:03
home
上一页
19
20
21
22
23
24
25
26
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他