原创 【PAT甲級】1029 Median

Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median

原创 【記錄】2019年北京理工大學計算機學院推免複試機試上機題

  推免到今天也終於告一段落啦,答應達仔寫了複試機試的題目,其實都是很簡單的題,測試用例也是老師手動輸入的,沒有極端樣例,一共兩題,一題10分。 第一題 在一行內輸入數個字符串,每個字符串用空格隔開,求輸出所有字符串的最大前綴子串(區分大

原创 【PAT甲級】1048 Find Coins(散列/二分)

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

原创 【PAT甲級】1084 Broken Keyboard(散列)

On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to t

原创 【PAT甲級】1041 Be Unique(散列)

Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning

原创 【PAT甲級】1092 To Buy or Not to Buy(散列)

Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There

原创 【PAT甲級】1050 String Subtraction(散列)

Given two strings S​1​​ and S​2​​, S=S​1​​−S​2​​ is defined to be the remaining string after taking all the characters

原创 【PAT甲級】1070 Mooncake(貪心)

Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and cru

原创 【PAT乙級】1086 就不告訴你

做作業的時候,鄰座的小盆友問你:“五乘以七等於多少?”你應該不失禮貌地圍笑着告訴他:“五十三。”本題就要求你,對任何一對給定的正整數,倒着輸出它們的乘積。 輸入格式: 輸入在第一行給出兩個不超過 1000 的正整數 A 和 B,其間以空

原创 【PAT乙級】1088 三人行

子曰:“三人行,必有我師焉。擇其善者而從之,其不善者而改之。” 本題給定甲、乙、丙三個人的能力值關係爲:甲的能力值確定是 2 位正整數;把甲的能力值的 2 個數字調換位置就是乙的能力值;甲乙兩人能力差是丙的能力值的 X 倍;乙的能力值是丙

原创 【PAT乙級】1087 有多少不同的值

當自然數 n 依次取 1、2、3、……、N 時,算式 ⌊n/2⌋+⌊n/3⌋+⌊n/5⌋ 有多少個不同的值?(注:⌊x⌋ 爲取整函數,表示不超過 x 的最大自然數,即 x 的整數部分。) 輸入格式: 輸入給出一個正整數 N(2≤N≤10​

原创 【環境配置】Win10系統下jdk-11.0.2配置過程

Java裝了好幾次,每次都要重新找環境變量的設置,在此記錄一下。 1. 下載JDK 可以在Java下載最新版的JavaSE安裝包https://www.oracle.com/technetwork/java/javase/download

原创 【算法筆記】快速冪的兩種寫法(遞歸法+迭代法)

快速冪的遞歸法 // 求a^b%m ll binaryPow(ll a, ll b, ll m) { if (b == 0) return 1; if (b %2 == 1) { return a * binaryPow(a,

原创 【經典問題】N皇后(回溯法)

假期稍微回顧一下一些經典問題的寫法 說明: N皇后問題遍歷的話太耗時間,因此使用回溯法解決 代碼 #include <cstdio> #include <cmath> #include <iostream> #define ll lon

原创 【數字圖像處理】MATLAB實現圖像旋轉

前言 上節課學習了實現圖像旋轉的原理,下課後用matlab實現了一下圖像旋轉的功能,這裏做個記錄。 圖像旋轉原理 圖像旋轉的本質利用的是向量的旋轉。 矩陣乘法的實質是進行線性變換,因此對一個向量進行旋轉操作也可以通過矩陣和向量相乘的方式進