原创 PAT--1044 Shopping in Mars--尺取

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805439202443264 題目大意:有n個數,求這n個數當中所有連續的和爲m的子數組,如果找不到,

原创 java:String

常用方法 1、str.length():返回字符串長度。 2、str.charAt(index):返回字符串中指定位置的字符。 3、str.indexOf(substr):返回字符串中第一次出現substr的位置,沒有返回-1。 4、s

原创 PAT--1056 Mice and Rice-queue

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805419468242944 題目大意:第一行,np只老鼠,每ng只一組;第二行,每隻老鼠的重量;第三

原创 PAT--1064 Complete Binary Search Tree

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805407749357568 題目大意:給出n個數,讓你建立一棵完全二叉樹,並輸出層序遍歷的結果。 分

原创 幾種排序整理

快速排序 快速排序的思想是,先找一個基準(一般是最左邊的數),然後把比這個數小的移動到它的左邊,把比這個數大的移動到它的右邊,然後繼續對左子數組和右子數組進行同樣的操作,直到某個子數組只有一個元素爲止。 // 快速排序 #includ

原创 PAT--1129 Recommendation System

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805348471259136 題目大意:在用戶點擊第i個商品前,求出應該推薦的商品(最多k個)。 直接

原创 PAT--1078 Hashing

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805389634158592 題目大意:哈希,H(key)=key%TSize,如果有碰撞,用平方檢測

原创 PAT--1136 A Delayed Palindrome--大數相加

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805345732378624 大數相加,記個模板。 #include <bits/stdc++.h>

原创 Edge Deletion--最短路+bfs

題目鏈接:https://vjudge.net/problem/CodeForces-1076D 題目大意:給出n個點,m條邊,最多能保留K條邊。原圖上每個點的最短路爲di。現在刪除了邊後,使得到點1的距離仍爲di的點數量最多的情況下,輸

原创 PAT--1038 Recover the Smallest Number

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805449625288704 題目大意:給出n個數字的片段,會有前導零,讓你求出組合後的最小的數,最終

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

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805403651522560 題目大意:給定n個數的序列(0--n-1),每次執行swap(0, *)

原创 PAT--1053 Path of Equal Weight

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805424153280512 題目大意:給你一棵樹,根節點爲0,每個節點都有一個權值,再給定一個數nu

原创 PAT--1134 Vertex Cover

題目鏈接:https://pintia.cn/problem-sets/994805342720868352/problems/994805346428633088 題目大意:給出一個無向圖,再給出k組點的集合,問每一組點的集合能不能把每

原创 The Labyrinth--bfs

題目鏈接:https://vjudge.net/problem/CodeForces-616C#author=0 思路:bfs'.',這樣就可以把聯通在一起的'.',和成一個聯通塊,計算出'.'的個數,然後把這個聯通塊標號,放入mp中,最

原创 使用表單的POST方法實例

getTest.html <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>使用POST</title> </head> <body> <form action