原创 PTA KMP 串的模式匹配 (25 分)
#include <bits/stdc++.h> using namespace std; typedef int Pos; #define NotFound -1 void BuildMatch(char *pattern, i
原创 PTA 11-散列2 Hashing (25 分)
#include <bits/stdc++.h> using namespace std; bool isPrime(int n); int main() { #ifdef ONLINE_JUDGE #else freopen(
原创 PTA 7-14 電話聊天狂人 (25 分)
#include <bits/stdc++.h> using namespace std; map<long long, int> p; int main() { #ifdef ONLINE_JUDGE #else freope
原创 PTA 7-15 QQ帳戶的申請與登陸 (25 分)
#include <bits/stdc++.h> using namespace std; map<string, string> M; int main() { #ifdef ONLINE_JUDGE #else freope
原创 PTA 7-13 統計工齡 (20 分)
#include <bits/stdc++.h> using namespace std; int main() { #ifdef ONLINE_JUDGE #else freopen("in.txt", "r", stdin)
原创 PTA 7-16 Sort with Swap(0, i) (25 分)
#include <bits/stdc++.h> using namespace std; struct Elem{ bool isSelec = false; int data; }; int ElemCntinEachCirc
原创 PTA 09-排序2 Insert or Merge (25 分)
#include <bits/stdc++.h> using namespace std; int main() { #ifdef ONLINE_JUDGE #else freopen("in.txt", "r", stdi
原创 PTA 09-排序3 Insertion or Heap Sort (25 分)
#include <bits/stdc++.h> using namespace std; int main() { #ifdef ONLINE_JUDGE #else freopen("in.txt", "r", stdin
原创 PTA 7-12 How Long Does It Take (25 分)
#include <bits/stdc++.h> using namespace std; const int maxn = 100; int mapn[maxn][maxn], dis[maxn]; int in[maxn];
原创 PTA 7-10 公路村村通 (30 分)
#include <bits/stdc++.h> using namespace std; const int inf = 999999; int n, m; //N爲城鎮數目,M爲候選道路數目 int g[1000][1000
原创 16. 編寫程序,使其具有以下功能: (1) 創建一個能夠記錄6個任意整數的單向鏈表。要求:這6個整數必須從鍵盤獲得,並分別保存在鏈表的不同節點中。 (2) 使用循環語句,遍歷已經創建完成的鏈表,求
#include <stdio.h> #include <stdlib.h> #include <bits/stdc++.h> using namespace std; typedef struct ListNode{ int
原创 12.編寫程序,其功能是從鍵盤輸入n*n個整型數(n≤20),組成n行n列數組,打印出其上三角數組。
#include <stdio.h> int main() { int Matrix[20][20]; int size; int i, j; scanf("%d", &size); for(i = 0; i < si
原创 13. 編寫程序,使其具有以下功能: (1) 定義一個用來表示商品信息的結構體類型shangpin,該結構體包含三個成員,分別爲spid、spname和spdj,其中spid表示商品號,類型爲字符數
#include <stdio.h> #include <stdlib.h> typedef struct shangpin{ char spid[7]; char spname[15]; float spdj; }shan
原创 在Vs中調試查看隊列元素
*((((*((std::_Deque_alloc<std::_Deque_base_types<int,std::allocator<int> > >*)(&((q).c))))._Mypair)._Myval2)._Map),3
原创 中國大學MOOC-陳越、何欽銘-數據結構-2018秋 06-圖3 六度空間 (30 分)
#include <bits/stdc++.h> using namespace std; int const MAXV = 10000; int vertex, edge; int visited[MAXV] = {0}; in