打完最后的分數是170,三等還差5分
除了模板25分是我的鍋之外(明明考前還看了的),,
還有L1最后一題列標號567沒減3扣了2分,L2第二題身份證號碼是數字扣了4分。
以及改了一個多小時(。。。)L3題目沒來得及看
//開兩個棧直接模擬 #include using namespace std; typedef long long LL; int main(){ int n; cin>>n; stacks1; stacks2; for(int i = 1; i <= n; i++){ int x; cin>>x; s1.push(x); } for(int i = 1; i < n; i++){ char ch; cin>>ch; s2.push(ch); } while(s1.size()>1){ int n1 = s1.top(); s1.pop(); int n2 = s1.top(); s1.pop(); char op = s2.top(); s2.pop(); if(op=='+') s1.push(n2+n1); else if(op=='-') s1.push(n2-n1); else if(op=='*') s1.push(n2*n1); else{ if(n1==0){ cout<<"ERROR: "<1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//+ 在D天里發口罩,每個人獲得要間隔P天。 //+ 給出每天的申請記錄和口罩供應,包括string,id,siates,time;按照先后順序判斷每天發給誰。 //+ 并統計狀態出問題的人,匯總輸出。 //+ 直接模擬即可。能獲得口罩的人,P天內沒拿過,并且每天排名前幾個。 #include using namespace std; struct node{string name, id; int states; int t1, t2;};//申請,出現時間 bool cmp(node a, node b){return a.t1!=b.t1?a.t1>d>>p; mapmp;//相隔天數 vectorans; setse;//生病的人 for(int i = 1; i <= d; i++){ int t, c; cin>>t>>c; vectortmp; for(int j = 1; j <= t; j++){ string name, id; int states, mm, hh; char ch; cin>>name>>id>>states>>hh>>ch>>mm; if(checkid(id)){ tmp.push_back({name,id,states,hh*60+mm,j}); if(states==1 && se.count(id)==0){ ans.push_back({name,id,states,hh*60+mm,j}); se.insert(id); } } } if(tmp.size()==0 || c==0)continue; sort(tmp.begin(),tmp.end(), cmp); for(int j = 0; j < tmp.size() && c; j++){ if(mp.count(tmp[j].id)==0 || mp[tmp[j].id]+p+1<=i){ mp[tmp[j].id] = i; c--; cout<1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//滿二叉樹后序轉先序,輸出層次遍歷 #include using namespace std; typedef long long LL; const int maxn = 100010; int n, a[maxn]; int Tree[maxn], r; void build(int x){ if(x>n)return ; build(x<<1); build(x<<1|1); Tree[x] = a[++r]; } int main(){ cin>>n; for(int i = 1; i <= n; i++) cin>>a[i]; build(1); for(int i = 1; i <= n; i++){ if(i!=1)cout<<" "; cout<1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//+ n個點m條帶權邊。給出k條路徑,判斷能否從v1出發經過每個點一次并返回v1,輸出最短的路徑。 //+ n<200 所以鄰接矩陣存個圖,直接暴力枚舉就行。 #include using namespace std; typedef long long LL; const int inf = 1e9+10; const int maxn = 220; int e[maxn][maxn], vis[maxn]; int main(){ int n, m; cin>>n>>m; for(int i = 0; i <= n; i++) for(int j = 0; j <= n; j++) e[i][j] = inf; for(int i = 1; i <= m; i++){ int u, v, w; cin>>u>>v>>w; e[u][v] = e[v][u] = w; } int k; cin>>k; int cnt = 0, po = 0, hf = inf; for(int i = 1; i <= k; i++){ memset(vis,0,sizeof(vis)); int kk; cin>>kk; int la = 0, tmphf = 0, ok = 1; for(int j = 1; j <= kk; j++){ int x; cin>>x; if(e[la][x]!=inf && !vis[x]){ //cout<1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
二叉樹
版權聲明:本文內容由網絡用戶投稿,版權歸原作者所有,本站不擁有其著作權,亦不承擔相應法律責任。如果您發現本站中有涉嫌抄襲或描述失實的內容,請聯系我們jiasou666@gmail.com 處理,核實后本網站將在24小時內刪除侵權內容。