原创 PAT 1067 Sort with Swap(0, i) (貪心)

1067 Sort with Swap(0, i) (25分) Given any permutation of the numbers {0, 1, 2,..., N−1}, it is easy to sort them in inc

原创 PAT 1074 Reversing Linked List (鏈表轉置)

1074 Reversing Linked List (25分) Given a constant K and a singly linked list L, you are supposed to reverse the links o

原创 PAT 1073 Scientific Notation

1073 Scientific Notation (20分) Scientific notation is the way that scientists easily handle very large numbers or very

原创 PAT 1079 Total Sales of Supply Chain

1079 Total Sales of Supply Chain (25分) A supply chain is a network of retailers(零售商), distributors(經銷商), and suppliers(

原创 PAT 1086 Tree Traversals Again(中,前,後)

1086 Tree Traversals Again (25分) An inorder binary tree traversal can be implemented in a non-recursive way with a stac

原创 PAT 1089 Insert or Merge

1089 Insert or Merge (25分) According to Wikipedia: Insertion sort iterates, consuming one input element each repetition

原创 PAT 1096 Consecutive Factors

1096 Consecutive Factors (20分) Among all the factors of a positive integer N, there may exist several consecutive numbe

原创 PAT 1097 Deduplication on a Linked List

1097 Deduplication on a Linked List (25分) Given a singly linked list L with integer keys, you are supposed to remove th

原创 PAT 1148 Werewolf - Simple Version

1148 Werewolf - Simple Version (20分) Werewolf(狼人殺) is a game in which the players are partitioned into two parties: the

原创 漢諾塔問題(遞歸)

1個盤子的漢諾塔問題可直接移動。 n個盤子的漢諾塔問題可遞歸表示爲,首先把上邊的n-1個盤子從A柱藉助C移到B柱,然後把最下邊的一個盤子從A柱移到C柱,最後把移到B柱的n-1個盤子再借助A移到C柱。 代碼: #include <bits

原创 藍橋——2n皇后問題(dfs)

2n皇后問題 資源限制 時間限制:1.0s   內存限制:512.0MB 問題描述   給定一個n*n的棋盤,棋盤中有一些位置不能放皇后。現在要向棋盤中放入n個黑皇后和n個白皇后,使任意的兩個黑皇后都不在同一行、同一列或同一條對角線上,任

原创 Spring學習筆記02-面向切面編程AOP

Spring 文章目錄Spring解決冗餘:動態代理基於接口的動態代理基於子類的動態代理使用Spring的AOP解決代碼冗餘spring中基於xml的AOP切入點表達式的寫法使用註解配置AOP注意 解決冗餘:動態代理 特點:字節

原创 MyBatis學習筆記_3-多表查詢

Mybatis 文章目錄Mybatis多表查詢一對一一對一示例1、從表實體類中應該包含一個主表實體類的對象引用2、AccountDao接口3、AccountDao的mapper中4、AccountDao的測試類一對多一對多示例1、

原创 MyBatis學習筆記_1

Mybatis 文章目錄Mybatismybatis概述mybatis入門IDEA基本環境的搭建環境搭建的注意事項mybatis入門案例過程其他(基於註解) mybatis概述 Mybatis是一個持久層框架(跟數據庫打交道的)

原创 Spring學習筆記03-JdbcTemplate

Spring 文章目錄Spring什麼是JdbcTemplateJdbcTemplate對象的創建JdbcTemplate的增刪改查操作關於查詢操作在Dao層直接使用JdbcTemplate在Dao層對象繼承JdbcDaoSupp