☆AC Saber☆【基础知识一】快速排序

 1. A + B

 

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 
 4 typedef unsigned long long L;
 5 
 6 int main()
 7 {
 8     L n, m; cin >> n >> m;
 9     cout << n+m;
10 }

 

785. 快速排序

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 
 4 typedef unsigned long long L;
 5 
 6 int main()
 7 {
 8     L n, a[100001]; cin >> n;
 9     for(int i = 0; i < n; i++) cin >> a[i];
10     sort(a, a+n);
11     for(int i = 0; i < n; i++)
12     {
13         cout << a[i]; if(i!=n-1) cout << " ";
14     }
15     return 0;
16 }

 

786. 第k个数

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 
 4 typedef unsigned long long L;
 5 
 6 int main()
 7 {
 8     L n, k, a[100001]; cin >> n >> k;
 9     for(int i = 0; i < n; i++) cin >> a[i];
10     sort(a, a+n);
11     cout << a[k-1];
12     return 0;
13 }

 

105. 七夕祭

 

输入样例:

2 3 4
1 3
2 1
2 2
2 3

输出样例:

row 1

 

【AC代码】

 

posted @ 2020-09-05 22:34  $KAMISAMALZ  阅读(240)  评论(0编辑  收藏  举报