Skip to content

Commit 65a4104

Browse files
committed
update encoding
1 parent 0973189 commit 65a4104

File tree

56 files changed

+260
-195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+260
-195
lines changed

.editorconfig

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ root = true
44
# all files
55
[*]
66
indent_style = tab
7-
indent_size = 4
7+
indent_size = 4
8+
charset = utf-8

.vscode/tasks.json

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
// See https://go.microsoft.com/fwlink/?LinkId=733558
3+
// for the documentation about the tasks.json format
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"label": "clean",
8+
"type": "shell",
9+
"command": "Remove-Item * -Include *.obj,*.exe -Recurse",
10+
"group": "build",
11+
"presentation": {
12+
"echo": true,
13+
"reveal": "always",
14+
"focus": false,
15+
"panel": "shared"
16+
},
17+
"problemMatcher": []
18+
},
19+
{
20+
"label": "compile",
21+
"type": "shell",
22+
"command": "build.bat '${relativeFileDirname}/${fileBasenameNoExtension}'",
23+
"group": "build",
24+
"dependsOn": "clean",
25+
"presentation": {
26+
"echo": true,
27+
"reveal": "always",
28+
"focus": false,
29+
"panel": "shared"
30+
},
31+
"problemMatcher": {
32+
"owner": "cpp",
33+
"fileLocation": [
34+
"relative",
35+
"${workspaceFolder}"
36+
],
37+
"pattern": {
38+
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
39+
"file": 1,
40+
"line": 2,
41+
"column": 3,
42+
"severity": 4,
43+
"message": 5
44+
}
45+
}
46+
},
47+
{
48+
"label": "run",
49+
"type": "shell",
50+
"command": ".\\'${relativeFileDirname}/${fileBasenameNoExtension}.exe'",
51+
"group": {
52+
"kind": "build",
53+
"isDefault": true
54+
},
55+
"dependsOn": "compile",
56+
"presentation": {
57+
"echo": true,
58+
"reveal": "always",
59+
"focus": false,
60+
"panel": "shared"
61+
},
62+
"problemMatcher": []
63+
}
64+
]
65+
}

PAT (Advanced Level) Practise/1003_Emergency (25).cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ int matrix[N][N];
1212

1313
vector<int> path;
1414

15-
void DFS(int next)//深搜 + 回溯
15+
void DFS(int next)//深搜 + 回溯
1616
{
1717
int i;
18-
if(next == e)//如果当前点是目标点
18+
if(next == e)//如果当前点是目标点
1919
{
2020
int curTeam = 0, curDis = 0;
2121
for(i = 0; i < path.size(); i++)
@@ -85,14 +85,14 @@ int main()
8585
minDis = 0x7fffffff;
8686
maxTeam = -1;
8787

88-
//搜索+回溯开始
88+
//搜索+回溯开始
8989
vis[s] = 1;
9090
path.push_back(s);
9191
DFS(s);
9292
path.pop_back();
9393
vis[s] = 0;
9494

95-
//打印答案
95+
//打印答案
9696
cout << numDis << " " << maxTeam << endl;
9797
}
9898
return 0;

PAT (Advanced Level) Practise/1004_Counting Leaves (30).cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ int main()
2828
int n,m,i,j,k;
2929
string ID,tmpID;
3030

31-
map<string, node*> hash;//hash¸÷¸ö½áµã
31+
map<string, node*> hash;//hash各个结点
3232

3333

3434
while(cin >> n >> m)

PAT (Advanced Level) Practise/1010_Radix (25).cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
//第七组样例超时
2-
//1、需要二分答案....
3-
//2、结果用long long
1+
//第七组样例超时
2+
//1、需要二分答案....
3+
//2、结果用long long
44

55

66
#include <iostream>

PAT (Advanced Level) Practise/1014_Waiting in Line (30).cpp

+11-11
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pair<int,int> Windows[25];
1313
map<int,int> ans;
1414
int n,m,k,query,i,j,val;
1515

16-
//判断是否有窗口为空
16+
//判断是否有窗口为空
1717
bool has_Windows(int &win_num)
1818
{
1919
for(int i = 1; i <= n; i++)
@@ -27,7 +27,7 @@ bool has_Windows(int &win_num)
2727
return false;
2828
}
2929

30-
//补充排队人数
30+
//补充排队人数
3131
bool has_Queue()
3232
{
3333
for(int i = 1; i <= n; i++)
@@ -58,7 +58,7 @@ int main()
5858
Peo.push( make_pair(i,val) );
5959
}
6060

61-
//初始化各个窗口前的排队队列
61+
//初始化各个窗口前的排队队列
6262
while(q[n].size() != m && !Peo.empty())
6363
{
6464
for(i = 1; i <= n; i++)
@@ -71,10 +71,10 @@ int main()
7171
}
7272
}
7373

74-
int time = 8*60;//起始时间
74+
int time = 8*60;//起始时间
7575
while(time < 17*60)
7676
{
77-
//窗口工作
77+
//窗口工作
7878
for(i = 1; i <= n; i++)
7979
{
8080
if(Windows[i].second != 0)
@@ -87,18 +87,18 @@ int main()
8787
}
8888
}
8989

90-
//窗口空闲,调入排队的人
90+
//窗口空闲,调入排队的人
9191
int win_num = -1;
9292
while(has_Windows(win_num))
9393
{
9494
Windows[win_num] = q[win_num].front();
95-
//cout << "人员" <<q[win_num].front().first << "进入窗口" <<win_num<<endl;
96-
//cout << "人员" << q[win_num].front().first << "将在"
97-
// <<(q[win_num].front().second+time )/60<< ":"<<(q[win_num].front().second+time )%60<<"完成"<<endl;
95+
//cout << "人员" <<q[win_num].front().first << "进入窗口" <<win_num<<endl;
96+
//cout << "人员" << q[win_num].front().first << "将在"
97+
// <<(q[win_num].front().second+time )/60<< ":"<<(q[win_num].front().second+time )%60<<"完成"<<endl;
9898
//cout << endl;
9999
ans[q[win_num].front().first] = q[win_num].front().second+time;
100100
}
101-
//补充窗口前排队人数
101+
//补充窗口前排队人数
102102
while(has_Queue())
103103
{
104104
int minSize = 100000;
@@ -117,7 +117,7 @@ int main()
117117
if(!Peo.empty() && index != -1)
118118
{
119119
q[index].push(Peo.front());
120-
//cout << "人员" <<Peo.front().first << "进入队列" <<index<<endl;
120+
//cout << "人员" <<Peo.front().first << "进入队列" <<index<<endl;
121121
Peo.pop();
122122
}
123123
else

PAT (Advanced Level) Practise/1017_Queueing at Bank (25).cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
//原始版
2-
//fuck 只要除以合法人数 而不是总人数 第一个Sample 老是跑不对, 原因在这。
1+
//原始版
2+
//fuck 只要除以合法人数 而不是总人数 第一个Sample 老是跑不对, 原因在这。
33
#include <iostream>
44
#include <cstdio>
55
#include <cstring>
@@ -79,7 +79,7 @@ int main()
7979

8080

8181
/*
82-
//在自己基础上,照着网上的其他人改了下。 窗口其实像上面定义成Int就好了,这个我觉得写的还麻烦了。
82+
//在自己基础上,照着网上的其他人改了下。 窗口其实像上面定义成Int就好了,这个我觉得写的还麻烦了。
8383
8484
#include <iostream>
8585
#include <cstdio>

PAT (Advanced Level) Practise/1018_Public Bike Management (30).cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
//理解题目有误啊。
2-
//Back 那个前面计算有问题 5和7测试用例一直过不了,
3-
//后面参考了http://linest.iteye.com/blog/1423959
4-
//然后拿下了。
1+
//理解题目有误啊。
2+
//Back 那个前面计算有问题 5和7测试用例一直过不了,
3+
//后面参考了http://linest.iteye.com/blog/1423959
4+
//然后拿下了。
55
#include <iostream>
66
#include <cstdio>
77
#include <vector>
@@ -59,7 +59,7 @@ void dfs(int ID, int curDis, int curNum,int cnt)
5959
}
6060
}
6161

62-
//路径更小
62+
//路径更小
6363
if(curDis < minDis)
6464
{
6565
minDis = curDis;
@@ -89,13 +89,13 @@ void dfs(int ID, int curDis, int curNum,int cnt)
8989
{
9090
if(!vis[adj[ID][i].first] && curDis + adj[ID][i].second <= minDis)
9191
{
92-
//cout << "访问" << adj[ID][i].first << endl;
92+
//cout << "访问" << adj[ID][i].first << endl;
9393
vis[adj[ID][i].first] = 1;
9494
path.push_back(adj[ID][i].first);
9595
dfs(adj[ID][i].first, curDis + adj[ID][i].second, curNum+numOfBike[adj[ID][i].first], cnt+1);
9696
path.pop_back();
9797
vis[adj[ID][i].first] = 0;
98-
//cout << "回溯" << adj[ID][i].first << endl;
98+
//cout << "回溯" << adj[ID][i].first << endl;
9999
}
100100
}
101101
}

PAT (Advanced Level) Practise/1020_Tree Traversals (25).cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,22 @@ node::node(const int &v)
2626
}
2727

2828
void build(node * &r, int post[],int in[],int postLeft,int postRight, int inLeft, int inRight)
29-
{//构造以r为根的二叉树
29+
{//构造以r为根的二叉树
3030
if(inLeft > inRight)
31-
{//二叉树无结点,空二叉树
31+
{//二叉树无结点,空二叉树
3232
r = NULL;
3333
}
3434
else
3535
{
3636
r = new node(post[postRight]);
3737
int mid = inLeft;
3838
while(in[mid] != post[postRight])
39-
{//找出中序遍历中根的位置
39+
{//找出中序遍历中根的位置
4040
mid++;
4141
}
42-
//cout << "根:" << post[postRight] << endl;
43-
//cout << "左:" << postLeft << " " << postLeft+(mid-1) << " " << inLeft << " " << mid-1 << endl;
44-
//cout << "右:" << postLeft+mid << " " << postLeft+mid-inLeft << " " << mid+1 << " " << inRight << endl;
42+
//cout << "根:" << post[postRight] << endl;
43+
//cout << "左:" << postLeft << " " << postLeft+(mid-1) << " " << inLeft << " " << mid-1 << endl;
44+
//cout << "右:" << postLeft+mid << " " << postLeft+mid-inLeft << " " << mid+1 << " " << inRight << endl;
4545
//system("pause");
4646
build(r->left, post, in, postLeft, postLeft+(mid-1-inLeft), inLeft, mid-1);
4747
build(r->right, post, in, postLeft+mid-inLeft, postRight-1, mid+1, inRight);

PAT (Advanced Level) Practise/1021_Deepest Root (25).cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
并查集判断 树的个数
3-
第1次BFS找到最远叶子结点
4-
第2次BFS找到距离最远的所有结点集合
2+
并查集判断 树的个数
3+
第1次BFS找到最远叶子结点
4+
第2次BFS找到距离最远的所有结点集合
55
*/
66
#include <iostream>
77
#include <cstring>
@@ -99,7 +99,7 @@ int main()
9999
else
100100
{
101101
set<int> ans;
102-
int farMax = bfs(1);//离1最远距离
102+
int farMax = bfs(1);//离1最远距离
103103
int tmp;
104104
for(i = 1; i <= n; i++)
105105
{
@@ -109,8 +109,8 @@ int main()
109109
break;
110110
}
111111
}
112-
farMax = bfs(tmp);//寻找距离最远的两点
113-
ans.insert(tmp);//自身也要加入
112+
farMax = bfs(tmp);//寻找距离最远的两点
113+
ans.insert(tmp);//自身也要加入
114114
for(i = 1; i <= n; i++)
115115
{
116116
if(dist[i] == farMax)

PAT (Advanced Level) Practise/1022_Digital Library (30).cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ map<string,set<string> > note;
1010
vector<string> vec;
1111
void StringSplit(string s,char splitchar,vector<string>& vec)
1212
{
13-
if(vec.size()>0)//保证vec是空的
13+
if(vec.size()>0)//保证vec是空的
1414
vec.clear();
1515
int length = s.length();
1616
int start=0;
1717
for(int i=0;i<length;i++)
1818
{
19-
if(s[i] == splitchar && i == 0)//第一个就遇到分割符
19+
if(s[i] == splitchar && i == 0)//第一个就遇到分割符
2020
{
2121
start += 1;
2222
}
@@ -25,7 +25,7 @@ void StringSplit(string s,char splitchar,vector<string>& vec)
2525
vec.push_back(s.substr(start,i - start));
2626
start = i+1;
2727
}
28-
else if(i == length-1)//到达尾部
28+
else if(i == length-1)//到达尾部
2929
{
3030
vec.push_back(s.substr(start,i+1 - start));
3131
}

0 commit comments

Comments
 (0)