原创 java_自定義異常
自定義異常格式: public class 異常類名 extends Exception { 無參構造 帶參構造 } 實例: 首先自定義一個分數異常類 ScoreException public class Score
原创 hdoj 1002 A + B Problem II(大數加法)
1002 A + B Problem II 可用作大數加法模板 #include<bits/stdc++.h> using namespace std; const int maxn = 1050; char a[maxn],b[ma
原创 6033 Add More Zero
題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=6033 計算2m−1的位數可以看成m位的2進制換成10進制的位數 #include<bits/stdc++.h> using nam
原创 hdoj 2639 Bone Collector II (01揹包的第k優解)
Bone Collector II(鏈接) Sample Input 3 5 10 2 1 2 3 4 5 5 4 3 2 1 5 10 12 1 2 3 4 5 5 4 3 2 1 5 10 16 1 2 3 4 5 5 4 3
原创 Redis緩存相關問題
Redis緩存相關問題 1 緩存穿透 緩存穿透是指查詢一個數據庫一定不存在的數據. 正常使用Redis緩存的流程大致是: 數據查詢首先進行緩存查詢 如果數據存在則直接返回緩存數據 如果數據不存在,就對數據庫進行查詢,並把查詢
原创 hdoj 1015 Safecracker(竊賊) Dfs
題目真是囉嗦=-= (A=1, B=2, ..., Z=26) v - w^2 + x^3 - y^4 + z^5 = target 輸入:tarrget+一段字符串 輸出:滿足條件的字符串(多個按字典序) #include<cs
原创 hdoj 1029 Ignatius and the Princess IV
題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1029 用map儲存 map<數字,該數字出現的次數>s; #include<iostream> #include<cstdio> #i
原创 hdoj 3535 AreYouBusy(混合揹包)
AreYouBusy Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission
原创 hdoj 1072 Nightmare 廣搜
Nightmare(題目鏈接) #include<istream> #include<algorithm> #include<queue> #include<cstdio> using namespace std; int t,n,m
原创 hdoj 1010 Tempter of the Bone
Tempter of the Bone Problem Description The doggie found a bone in an ancient maze, which fascinated him a lot. How
原创 hdoj 3449 Consumer(有依賴的揹包)
Consumer(鏈接) 題意: 給你一些物品,每個物品有自己的花費和價值,每個物品 都有相對應的箱子, 如果你想要買這個物品,你就需要先買這個箱子(依賴), 第一行先輸入一個n 和t 代表 有幾組物品 和你有多少錢(如果你要
原创 hdoj 1180 詭異的樓梯 bfs bfs bfs
詭異的樓梯(題目鏈接) #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #include<queue> using namespace
原创 poj 1321 棋盤問題(Dfs)
棋盤問題 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 49320 Accepted: 23874 Description 在一個給定形狀的棋盤(
原创 HDOJ 1017-A Mathematical Curiosity
A Mathematical Curiosity Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total
原创 hdoj 1003 Max Sum(動態規劃)
題目鏈接:http://acm.hdu.edu.cn/showproblem.php?pid=1003 題意:求最大連續子序列的和以及開始和結束的下標 #include<iostream> #include<algorithm> #inc