自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(24)
  • 收藏
  • 关注

原创 Test for Job(poj3249 拓扑+动态规划)

题目链接题意:从任意一个源点到目标点, 有向无环, 求路径的最大权值和,权值有负数。思路: 我的思路复杂了一点,用了两个vector分别保存岀度和入度, 当缩到当前这个点,它的所有前驱的值已经确定,所以选择最大的值叠加到当前点。动归方程:d[i] = max(d[i], d[vec[i][j]]+v[i]);//d[i]是i点的最大权值和, vec[i][j]是i的某一个前驱,选择

2015-09-18 10:52:57 516

原创 Number Sequence(hdu 5014)

题目链接题意:给出A数字序列,B序列与之元素相同, 各项对应异或, 求使得异或和最大的B序列。思路:虽然这道题给出A的序列, 但是要按照从大到小的顺序进行异或运算,因为使得大数异或和达到最大值的数一定比他小, 而这个小数就可以使用最大值和大数异或来找到。比如: 8 , 二进制是 1000, 异或能够得到的最大值是 1111, 所以与之匹配的数就为 1000^1111 = 011

2015-09-05 09:12:01 464

原创 Treasure (BNUOJ 44540 栈应用)

题目链接栈应用, 注意在 # 出现之后不能匹配的情况((#)((#((((()#include #include #include #include #include #include #include #include #include #include using namespace std;char str[100005];int num[10

2015-09-01 15:18:23 448

原创 Homework (BNUOJ 5134)

题目链接简单的字符串处理#include #include #include #include #include #include #include #include #include using namespace std;char str[100005];int cnt[26], tmp[26];int vis[26];int main(){

2015-09-01 15:13:15 483

原创 USACO ORZ(hdu4277 深搜剪枝)

题目链接题意:  给出n个数, 用这些数组成三个数, 问能够拼成三角形的数目思路: 深搜, 将这n个数分成三堆再判断是否组成三角形, 但是肯定会爆掉, 所以中间加上set判重剪枝。 虽然在中间进行判重 代码比较繁琐, 但是运行效率还是很可观的。#include #include #include #include #include #include #include

2015-08-30 09:54:28 648

原创 Safecracker(HDU1015 全排列回溯)

题目链接#include #include #include #include #include #include #include using namespace std;int num, len;char letter[15];int flag;int vis[15];bool cmp(char a, char b){ return a > b;}in

2015-08-23 16:13:18 627

原创 Tempter of the Bone(HDU 深搜)

题目链接#include #include #include #include #include #include #include using namespace std;int n, m, t;int flag;int sx, sy, dx, dy;char maze[8][8];int vis[8][8];int mv[4][2] = {{0, 1},{1, 0

2015-08-23 14:47:07 356

原创 A multiplication game

Description Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Stan always starts with p = 1, does his multiplication, then Ollie multiplies the n

2015-08-15 10:55:46 435

原创 Nim HDU2975

Nim DescriptionNim is a 2-player game featuring several piles of stones. Players alternate turns, and on his/her turn, a player’s move consists of removing one or more stones from any single pile. Pla

2015-08-14 16:03:09 469

原创 hdu1848 Fibonacci again and again

Fibonacci again and againProblem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的: F(1)=1; F(2)=2; F(n)=F(n-1)+F(n-2)(n>=3); 所以,1,2,3,5,8,13……就是菲波那契数列。 在HDOJ上有不少相关的题目,比如1005 Fibonacci

2015-08-13 09:43:15 553

原创 eclipse 配置 opencv (c++版)

1.首先要配置好NDK,前面一篇文章已经讲过了 2.将openv的路径添加在eclipse里面 3.配置文件 Android.mk Application.mk(自己创建) 两个文件在同 一路径LOCAL_PATH := $(call my-dir)include $(CLEAR_VARS)OPENCV_LIB_TYPE:=STATICifeq ("$(wildcard $(

2015-08-13 09:29:19 1029

原创 gift1

Greedy Gift GiversA group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends might or might not give some money to any or all of the other fri

2015-07-15 21:48:56 517

原创 Ride

Your Ride Is HereIt is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up

2015-07-15 16:36:37 521

原创 java中使用c++编程

java很强大,但是速度很慢,所以在很多方面都需要用到c++和java的混合编程。网上的步骤讲解很详细,这里就不加赘述,添加我认为比较重要的几点东西,希望对大家有用。总的来说就一句话,写一个java类,然后构建与之映射的c++头文件。一.流程:1.配置NDK,生成jni文件夹。里面的cpp文件,用来实现功能。Android.mk文件用来声明cpp文件。之后的c++源文件,头文件都放在这里。

2015-06-19 20:22:17 858

原创 Fire Net

Fire NetDescriptionSuppose that we have a square city with straight streets. A map of a city is a square board with n rows and n columns, each representing a street or a piece of wall.A

2015-03-13 16:31:53 451

原创 HDU RPG的错排

RPG的错排Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8140    Accepted Submission(s): 3337Problem Description今年暑假杭电ACM集训队第一次组成女生队,其中

2015-03-08 14:00:02 825

原创 蓝桥杯 最大最小公倍数

算法训练  最大最小公倍数问题描述已知一个正整数N,问从1~N中任选出三个数,他们的最小公倍数最大可以为多少。输入格式输入一个正整数N。输出格式输出一个整数,表示你找到的最小公倍数。样例输入9样例输出504数据规模与约定1 6。注:贪心,从最大的三个数开始考虑,如果最大的数为奇数,那么相邻的三个数中有两个奇数,最大公约

2015-02-24 13:35:45 3778 2

原创 蓝桥杯 K好数

算法训练 K好数问题描述如果一个自然数N的K进制表示中任意的相邻的两位都不是相邻的数字,那么我们就说这个数是K好数。求L位K进制数中K好数的数目。例如K = 4,L = 2的时候,所有K好数为11、13、20、22、30、31、33 共7个。由于这个数目很大,请你输出它对1000000007取模后的值。输入格式输入包含两个正整数,K和L。输出格式输出一个整数

2015-02-24 11:12:33 575

原创 蓝桥杯 最短路

算法训练 最短路问题描述给定一个n个顶点,m条边的有向图(其中某些边权可能为负,但保证没有负环)。请你计算从1号点到其他点的最短路(顶点从1到n编号)。输入格式第一行两个整数n, m。接下来的m行,每行有三个整数u, v, l,表示u到v有一条长度为l的边。输出格式共n-1行,第i行表示1号点到i+1号点的最短路。样例输入3 31 2 -1

2015-02-24 10:07:16 698

原创 蓝桥杯 日期计算

算法提高 日期计算    问题描述  已知2011年11月11日是星期五,问YYYY年MM月DD日是星期几?注意考虑闰年的情况。尤其是逢百年不闰,逢400年闰的情况。输入格式  输入只有一行  YYYY MM DD输出格式  输出只有一行  W数据规模和约定  1599   1   1   1 样例输入2011

2015-02-23 19:00:57 1078

原创 Longest Ordered Subsequence 题解报告

A -Longest Ordered Subsequence                                       Time Limit:2000MS    Memory Limit:65536KB    64bit IO Format:%I64d & %I64uDescriptionA numeric sequence of ai is orde

2015-02-11 12:11:05 536

原创 Longest Common Subsequence 题解报告

DescriptionProblem C: Longest Common SubsequenceSequence 1: Sequence 2: Given two sequences of characters, print the length of the longest common subsequence of both sequences. For examp

2015-02-11 11:27:42 795

原创 Fight the Monster题解报告

http://codeforces.com/problemset/problem/487/A题目大致意思是:Yang打怪兽,血量HP,攻击力ATK,防御力DEF。用HPY, ATKY, DEFY,表示Yang的属性,HPM, ATKM, DEFM表示怪兽的属性。每秒钟怪兽的血减少max(0, ATKY - DEFM),Yang的血减少max(0, ATKM - DEFY)。当怪兽的血小于等于0

2015-01-05 17:11:27 639

原创 Vasya and Basketball 题解报告

http://codeforces.com/problemset/problem/493/C题目大致意思是:两个队进行篮球比赛,三分线d未定,进球的距离大于d得三分,小于等于d得两分。分别给出两队进球的距离,要求确定d的值,使得第一队的分数减第二队的分数结果最大,输出此时的比分。思路:将两队的距离分别排序,再融合到一个大数组,排序。枚举大数组的每一个数据作为d,利用二分查找在两队中找到小于

2015-01-05 09:28:54 644

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除