原创 Java編程思想之吸血鬼數

看Java編程思想的時候看到了這個吸血鬼數,感覺比較有意思就想寫下來記錄一下,我的這個是針對四位數的,更高的也可以適當向上拓展,我寫的時候裏面比較麻煩的就是結果重複問題了,用了個靜態變量就好了,我的具體思想就是得到一個四位數,將它

原创 PAT甲級1002 A + B

PAT甲級1002 這個問題講的就是多項式加起來,根據題意設置一個數組把係數存儲起來就好了,最後輸出。 Talk is cheap, show me the code. #include <cstdio> #define MA

原创 c++常量方法相關內容(轉載)

本文總結了靜態成員的使用、單例的實現、常量對象與常量方法,以及如何將常量方法重載爲普通方法。 靜態成員 對象成員的聲明前加 static 即可定義爲靜態成員,靜態成員必須在聲明類的文件中進行聲明(通常會初始化),否則鏈接錯。 訪

原创 PAT甲級1007. Maximum Subsequence Sum (25)

PAT 1007. Maximum Subsequence Sum (25) 動態規劃,不多說了,看代碼就懂了。 #include <cstdio> using namespace std; int dp[10000], star

原创 Leetcode-033 Search in Rotated Sorted Array

今天我沒事幹,決定把好多天沒寫的Leetcode看一下,看到了33題,題目如下: 給定一個經過“旋轉變換”的有序數組還有一個你要查找的目標數字,給出目標數字在數組中的下標,不存在則返回-1。例如給定{4, 5, 6, 7, 0,

原创 Java使用正則表達式抓取Bing首頁每日圖片

Java學習到了正則表達式,總想做點有用的東西,這兩天想給電腦換壁紙,看到Bing每天的主頁圖片挺好看的,就尋思着抓下來。 第一步就是分析主頁的結構了這個Bing的主頁圖片直接使用小箭頭抓是抓不到的,在Network的Img裏我

原创 c++string與數字的互轉

c++string與數字的互轉 c++reference上面列舉了一些方法。 1.數字轉string: 數字轉string,標準庫裏專門提供了函數: 包含的頭文件 string,使用的話就是直接std::to_string(T

原创 使用python爲爬蟲獲取免費代理ip

免費代理ip的爬取 爬蟲一直是python使用的一個重要部分,而許多網站也爲此做了許多反爬措施,其中爬蟲訪問過於頻繁直接封ip地址也作爲一種“傷敵一千,自損八百”的方法被許多網站採用,代理ip便可以防止這種情況出現。 搜索免費

原创 LeetCode 826 Most Profit Assigning Work

LeetCode 826 Most Profit Assigning Work 傳送門 題目分析 We have jobs: difficulty[i] is the difficulty of the ith job, and

原创 LeetCode 838 Push Dominoes

LeetCode 838 Push Dominoes 傳送門 題目分析 There are N dominoes in a line, and we place each domino vertically upright. I

原创 LeetCode 807 Max Increase to Keep City Skyline

LeetCode 807 Max Increase to Keep City Skyline 傳送門 題目分析 In a 2 dimensional array grid, each value grid[i][j] repre

原创 LeetCode 825 Friends Of Appropriate Ages

LeetCode 825 Friends Of Appropriate Ages 傳送門 題目分析 Some people will make friend requests. The list of their ages is

原创 LeetCode 820 Short Encoding of Words

LeetCode 820 Short Encoding of Words 傳送門 題目分析 Given a list of words, we may encode it by writing a reference strin

原创 LeetCode 822 Card Flipping Game

LeetCode 822 Card Flipping Game 傳送門 題目分析 On a table are N cards, with a positive integer printed on the front and

原创 LeetCode 859 Score of Parentheses

LeetCode 859 Score of Parentheses 傳送門 題目分析 Given a balanced parentheses string S, compute the score of the string