摘要:
题目 2003年清华大学计算机考研上机 本题不可直接O(n)来搜索,数据量大,千万级别,1s过不去,所以采用二分查找。 代码 1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 阅读全文
posted @ 2021-03-02 21:59
Uitachi
阅读(130)
评论(0)
推荐(0)
摘要:
题目 代码 网上别人 1 #include<iostream> 2 #include<vector> 3 4 using namespace std; 5 6 int main(){ 7 int n, m; 8 while(cin >> n >> m){ 9 // students[i] 表示第 i 阅读全文
posted @ 2021-03-02 20:34
Uitachi
阅读(122)
评论(0)
推荐(0)
摘要:
题目 本题不能用快排,会超时,因为数据量大。若用快排将会是千万的复杂度,1s内过不去。本题采用哈希,将NlogN算法降低为N 代码 1 #include<iostream> 2 using namespace std; 3 #define OFFSET 500000 4 int h[1000001] 阅读全文
posted @ 2021-03-02 20:09
Uitachi
阅读(93)
评论(0)
推荐(0)
摘要:
题目 2006年浙大机试题 代码 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int main(){ 6 int n; 7 while(scanf("%d",&n) != EOF){ 8 int a[10 阅读全文
posted @ 2021-03-02 18:06
Uitachi
阅读(55)
评论(0)
推荐(0)
摘要:
题目 代码 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int ISYEAP(int x){ 6 if((x%100!=0 && x % 4 == 0) || (x % 400 == 0) )return 阅读全文
posted @ 2021-03-02 17:49
Uitachi
阅读(93)
评论(0)
推荐(0)
摘要:
题目 代码 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 5 int ISYEAP(int x){ 6 if((x%100!=0 && x % 4 == 0) || (x % 400 == 0) )return 阅读全文
posted @ 2021-03-02 17:40
Uitachi
阅读(64)
评论(0)
推荐(0)
摘要:
题目 2008年上海交大计算机上机题 代码 1 #include<iostream> 2 #include<algorithm> 3 #include<cstring> 4 using namespace std; 5 6 int ISYEAP(int x){ 7 if((x%100!=0 && x 阅读全文
posted @ 2021-03-02 17:23
Uitachi
阅读(132)
评论(0)
推荐(0)

浙公网安备 33010602011771号