- 博客(26)
- 收藏
- 关注
原创 编程练习B(最大二部图匹配)
A:Kindergarten(POJ3692)Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluDescriptionIn a kindergarten, there are a lot of kids. All girls of the kids know each other and all boy
2016-12-01 16:55:10 615
原创 编程练习A(回路问题)
A:Jogging Trails(POJ 2404)Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluDescriptionGord is training for a marathon. Behind his house is a park with a large network of joggin
2016-11-29 00:30:29 477
原创 编程练习9(图的连通性)
A:Popular Cows(POJ 2186)Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluDescriptionEvery cow’s dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 1
2016-11-29 00:16:45 713
原创 编程练习8(多源最短路)
A:Stockbroker GrapevineTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %lluDescriptionStockbrokers are known to overreact to rumours. You have been contracted to develop a method
2016-11-28 23:58:51 546
原创 编程练习7(最短路)
A:Frogger(POJ2253)DescriptionFreddy Frog is sitting on a stone in the middle of a lake. Suddenly he notices Fiona Frog who is sitting on another stone. He plans to visit her, but since the water is dir
2016-11-28 23:52:19 454
原创 编程练习六(最小生成树)
A:Agri-Net(POJ1258)Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 15626 Accepted: 6327 Description Farmer John has been elected mayor of his town! One of his campaign promise
2016-11-28 23:41:02 670
原创 编程练习5(图的遍历)
A:Knight Moves(POJ1915)DescriptionBackground Mr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from one position to another so fast. Can you beat him? The
2016-11-28 23:26:01 716
原创 编程练习四(并查集)
转载一个并查集的讲解: http://blog.csdn.net/pure_life/article/details/2922118A:Fool GameB:Is It A Tree?题目:A tree is a well-known data structure that is either empty (null, void, nothing) or is a set of one or mo
2016-09-26 00:54:46 334
原创 编程练习三(贪心算法)
A:Fence Repair题目:Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20,000) planks of wood, each having some integer le
2016-09-25 23:53:18 978
原创 编程练习二(动态规划)
A:zuma(记忆化搜索)题目: Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the i-th of which has color ci. The goal of the game is to destroy all the gemstones i
2016-09-25 23:29:45 749
原创 java语言的学习及练习
第一次作业题目: 设计一个表示分数的类Fraction。这个类用两个int类型的变量分别表示分子和分母。完成练习中学习的知识点: 1.java基本输入输出小结: http://blog.csdn.net/zhangpengju999/article/details/9704681 scanner用法:public static void main(String[] args) throws
2016-09-23 09:34:29 477
原创 matlab给java提供接口
本文主要对实验过程中出现的错误进行记录。如何使Matlab给java提供接口,详细见下文: http://blog.csdn.net/com_stu_zhang/article/details/7605391 matlab中想编译得到.jar文件时,编译出错,原因是java版本使用了1.8的版本,要切换回1.7版本。 Mac中切换java版本的方法见以下链接: http://blog.csd
2016-09-22 17:55:54 2011
转载 oj头文件
转自: http://blog.csdn.net/weizhuwyzc000/article/details/49469999#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>#include<string>#include<vector>#include<stack>#include<bits
2016-09-12 17:13:04 553
转载 oj系统上写代码的一些小技巧
转自:http://blog.csdn.net/liwenxin_at/article/details/48602631 程序书写过程中的一些小技巧: 1. freopen(“1.txt”,”r”,stdin); //程序运行后系统自动输入此文档里面的内容(不需要进行手动输入) freopen(“1.txt”,”w”,stdout); //程序输出的内容保存在此文件里 2. memset
2016-09-01 21:32:29 1047
原创 编程练习1:动态规划
总体感受: 太久不做OJ好僵硬, 需要好好练习啊。 网站:http://acm.hust.edu.cn/vjudge/contest/130692#overviewA题:Cutting Sticks题目:You have to cut a wood stick into pieces. The most affordable company, The Analog Cutting Machine
2016-09-01 19:44:19 486
原创 leetcode 9:Palindrome Number
题目: Determine whether an integer is a palindrome. Do this without extra space.想法: 题目说不能有额外的空间,其实意思是空间是O(1)O(1)的。所以不能将int类型转换为string类型再判断。我们的方案是每次首尾比较用div控制,还有就是负数不是回文数。解答:class Solution {public:
2016-09-01 00:34:09 300
原创 leetcode 8: String to Integer (C++中int、string等常见类型转换)
题目:Implement atoi to convert a string to an integer.想法简单题,只要会用C++ stringstream 即可。解答#include<sstream>class Solution {public: int myAtoi(string str) { stringstream stream; stream<<
2016-08-31 23:39:19 413
原创 leetcode 7:Reverse Integer(知识点:vector ,复习STL stack,queue)
题目:Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321解答:这道题很简单,但是很坑,测试数据产生的结果如果溢出的话,应该返回0,但是并没有在题目中写到。 测试int类型是否溢出的方法:用long long类型完全一样地做一遍,最后比较两者结果是否相同。#incl
2016-08-29 16:35:05 461
原创 leetcode 6: ZigZag Convertion(easy,知识点:string, vector)
题目:思路:直接遍历,每次遍历的字符分给不同字符串即可。代码:#include <vector>class Solution {public: string convert(string s, int numRows) { if(numRows == 1){ return s; } vector<string>a(n
2016-08-25 21:38:57 362
原创 leetcode 5(知识点:STL string )
题目: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.想法一题目满足最有子结构性质,可以用动态
2016-08-23 19:12:27 420
原创 leetcode 4 (知识点:stl:vector ,iterator )
题目:There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should beO(log(m+n)) O(log (m+n))算法思想(摘自网上,关键是为什么会
2016-08-22 23:21:58 344
原创 leetcode 3 Longest Substring Without Repeating Characters
题目: 想法: 用hash表存储,可以使查询时间降到O(1)O(1),两次循环遍历,实践复杂度为O(n2)O(n^2)。 代码如下:class Solution {public: int lengthOfLongestSubstring(string s) { int i, j; int zm[256]; int len1 = s.length();
2016-08-20 15:58:48 262
原创 VS中dll的使用
本文主要按照该博客实践: C++基础:动态链接库调用方法总结 http://blog.csdn.net/crich_moon/article/details/6039939创建动态链接库文件的主要步骤为: 1.创建MFC的dll 2.创建.h文件,声明导出的函数,如:extern "C" __declspec(dllexport) int _stdcall ADD(int a, int b
2016-08-20 10:58:56 527
原创 leetcode 2
leetcode 2: Add Two Numbers题目:想法1:342 + 465 = 802,再倒序放到链表里面输出。 这个想法虽然很自然,但是其实是有问题的。因为该法没有考虑两个数很大,链表很长的情况。在这种情况下,int ,long long等类型表示的范围都是有限的,所以结果总是会当数字很大的时候出错。想法二:用carry位纪录两个链表对应数字相加后的进位。下一位的数字为a + b +
2016-08-19 19:12:17 237
原创 java jni 的使用
本文使用程序基于该博客: http://blog.csdn.net/jiangwei0910410003/article/details/17465085 就其中细节部分进行一定纠正:首先用cmd进入src目录下,编译该JAVA类, 命令:javac ./com/jni/demo/JNIDemo.java 在该JNIDemo.java所在目录下生成JNIDemo.class然后在src目录下
2016-08-18 23:14:44 330
原创 leetcode 1
题目:Two Sumproblem: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. example:
2016-08-03 19:25:09 297
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人