原创 HDOJ1160 FatMouse's Speed 弄了一晚上還是WA了,感覺有不止一個解啊
#include <iostream> #include <algorithm> #include <fstream> #include <vector> using namespace std; struct FatMouse { i
原创 求最長遞減子序列
#include <iostream> #include <algorithm> #include <fstream> using namespac
原创 HDOJ 1087 Super Jumping! Jumping! Jumping!簡單DP
題目是:Problem DescriptionNowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU.
原创 HDOJ1052田忌賽馬
Here is a famous story in Chinese history. "That was about 2300 years ago. General Tian Ji was a high official in the
原创 HDOJ 1159 Common Subsequence
其實就是最長公共子序列的簡化版。 #include<stdio.h> int c[1000][1000]; int max(int x,int y){ if(x<y) x=y; return x; } int main(){
原创 HDOJ 2084 數塔問題
自底向上求解。狀態轉移方程是dp[i][j] = max(dp[i+1][j],dp[i+1][j+1]) + a[i][j]. 一開始一直WA,後來把數組最大下標值從100改成101就AC了。 #include <iostream>
原创 HDOJ1003 簡單DP問題
#include #include using namespace std; #define Min -999999 int main() { //ifstream cin("input.txt"); int dat
原创 HDOJ1004 so easy
#include #include using namespace std; #define Min -999999 int main() { //ifstream cin("input.txt");
原创 HD 1058 Humber Numbers。本地都通過了最終還是WA了,莫名其妙
#include <iostream> #include <fstream> using namespace std; int findMin(int a,int b) { return a>=b?b:a; } int main() {
原创 二叉樹ADT,周遊二叉樹,遞歸非遞歸,求節點的父節點,兄弟節點
#pragma once #include "BinaryTreeNode.h" #include<stack> enum Tags{Left,Right}; template<class T> class StackElem{ pub
原创 LeetCode Reverse Polish Notation求逆波蘭表達式值
public class Solution { public static int evalRPN(String[] tokens) { Stack<String> stack = new Stack<String>(); St
原创 二叉查找樹C++
#pragma once #include <iostream> using namespace std; enum ORDER_MODE { ORDER_MODE_PREV = 0, ORDER_MODE_MID, ORDER_MO
原创 HD1008簡單題
#include <iostream> #include <fstream> using namespace std; int main() { //ifstream cin("input.txt"); int floor[100],
原创 HD1009 經典貪心
#include <iostream> #include <algorithm> #include <fstream> #include <iomanip> using namespace std; #define MAX 1000 st
原创 LeetCode Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum s