原创 6.23 PAT 甲級 Battle Over Cities

It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all

原创 【轉】6.22

監督學習(Supervised Learning) 在監督學習中,給定一組數據,我們知道正確的輸出結果應該是什麼樣子,並且知道在輸入和輸出之間有着一個特定的關係。這麼說可能理解起來不是很清晰,沒關係,後面有具體的例子。 監督學習的分

原创 ???4.8/4.9 PAT 甲級 1010 Radix

Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 i

原创 4.9-4.11 閆氏dp分析法

那啥 寫這篇只是想總結一下白天聽課的成果。 強推一個up 大雪菜  一開始就是找一個什麼算法的時候搜到這個up的視頻,後來發現這個up講東西講的特別清楚,而且是他是真的牛逼,還有自己的網站 Acwing,裏面可以刷題啊之類的,還有很多課很

原创 4.9 PAT 甲級 1015 Reversible Primes

A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example i

原创 3.29《算法筆記》學習

1.快速冪 簡單來說,就是求a的b次模m。(a<10的9次,b<10的6次,m<10的9次) 按照傳統的思想就是a的乘法做b次循環,這種做法的複雜度爲O(b),當b的取值變爲<10的18次的時候,傳統的做法就無法支撐了,於是就有了快速冪的

原创 4.8 PAT 甲級 1023 Have Fun with Numbers

Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. D

原创 4.6 PAT 甲級 1071 Speech Patterns

People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others

原创 4.14 PAT 甲級 1052 Linked List Sorting

A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each str

原创 3.17 杭電研究生複試2015

1.給定一個字符串,計算字符串中數值的個數並求和。其中還包含了負號,若 緊跟負號的是一個數值,則表示這是一個負數,若後面跟着的不是數字,則不表 示什麼。  輸入:一個字符串 輸出:數值個數 數值和 列子 輸入:312ab-2-- -9--

原创 4.9 PAT 甲級 1100 Mars Numbers

People on Mars count their numbers with base 13: Zero on Earth is called "tret" on Mars. The numbers 1 to 12 on Earth i

原创 6.2 PAT 甲級 1068 Find More Coins

Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a un

原创 5.22 PAT 甲級 1007 Maximum Subsequence Sum

Given a sequence of K integers { N​1​​, N​2​​, ..., N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​

原创 5.22 PAT 甲級 1045 Favorite Color Stripe

Eva is trying to make her own color stripe out of a given one. She would like to keep only her favorite colors in her f

原创 (matlab)error:無法打開要寫入的文件 XXX。您可能沒有寫入權限。

錯誤使用 imwrite (line 454) 無法打開要寫入的文件 "01.bmp"。您可能沒有寫入權限。   可能性1:可能是路徑的文件名中有中文,將路徑名中的中文部分改成英文 可能性2:可能寫入的地址是絕對路徑,改成相對路徑