- 博客(55)
- 收藏
- 关注
原创 leetcode 189. 旋转数组
思维题给定一个数组,将数组中的元素向右移动k个位置,其中k是非负数。示例 1:输入: [1,2,3,4,5,6,7] 和 k = 3输出: [5,6,7,1,2,3,4]解释:向右旋转 1 步: [7,1,2,3,4,5,6]向右旋转 2 步: [6,7,1,2,3,4,5]向右旋转 3 步: [5,6,7,1,2,3,4]示例2:输入: [-1,-100,3,99] 和 k = 2输出: [3,99,-1,-100]解释:向右旋转 1 步: [99,-1,-1...
2021-01-08 12:59:04 103
原创 数据库_数据库编程
收藏自:lxwthinker链接:https://me.csdn.net/lxw983520 嵌入式SQLhttps://blog.csdn.net/lxw983520/article/details/80947983 过程化sql:https://blog.csdn.net/lxw983520/article/details/80918581 ODBC:https...
2020-04-28 15:23:05 122
原创 1139 First Contact (20/30 分)
码上,再来补2019年2月25日9:30#include <iostream>#include <vector>#include <queue>#include <algorithm>using namespace std;int n, m;const int maxn = 2e4 + 5;;vector&l...
2019-02-25 09:32:01 167
原创 1143 Lowest Common Ancestor (30 分)
#include <iostream>#include <vector>#include <map>#include <cstdio>using namespace std;vector<int> p;map<int, int> mp;bool check(int x, int u, int v){ ...
2019-02-24 15:11:04 168
原创 1147 Heaps (30 分)后序遍历
2019年2月23日17:17#include <iostream>#include <vector>#include <cstring>using namespace std;vector<int> a, p;int n, m, x; bool ismax(){ for(int i = 1; i &...
2019-02-23 17:18:17 120
原创 1096 Consecutive Factors (20 分)
#include <iostream>#include <cmath>using namespace std;typedef long long LL;int main(){ //cout << pow(2, 31) << endl; LL n, m; LL cnt, maxc= 0, mini; whil...
2019-02-18 16:26:21 95
原创 1093 Count PAT's (25 分)思维
2019年2月18日15:29思维,每个A前P数量和后T数量之积的和#include <iostream>#include <string>using namespace std;typedef long long LL;const LL mod = 1000000007;const LL maxn = 1e5 +5;int mai...
2019-02-18 15:55:29 157
原创 1094 The Largest Generation (25 分)bfs
2019年2月17日21:13#include <iostream>#include <vector>#include <queue>#include <algorithm>#include <map>#include <cstdio>#include <cstring>usi
2019-02-17 21:15:18 102
原创 1092 To Buy or Not to Buy (20 分)
2019年2月17日19:59#include <iostream>#include <vector>#include <map>using namespace std;int main(){ string s1, s2; while(cin >> s1 >> s2) ...
2019-02-17 20:01:44 92
原创 1090 Highest Price in Supply Chain (25 分)bfs
#include <iostream>#include <vector>#include <cstdio>#include <queue>#include <cstring>using namespace std;const int maxn = 2e5 + 6;typedef struct P{ int ...
2019-02-16 22:37:51 102
原创 1088 Rational Arithmetic (20 分)
2019年2月16日11:41#include <iostream>#include <cstdio>using namespace std;typedef long long LL;typedef struct P{ LL x; LL a, b;}P;P p[10], ans, t1, t2;LL gcd...
2019-02-16 11:45:49 183
原创 1085 Perfect Sequence (25 分)
2019年2月15日22:35#include <iostream>#include <vector>#include <algorithm>using namespace std;int main(){ long long n, p, x, y, ans; vector<long long>...
2019-02-15 22:37:00 143
原创 1084 Broken Keyboard (20 分)
2019年2月14日22:04#include <iostream>#include <algorithm>#include <string>#include <cstring>#include <map>using namespace std; int main(){ string s1...
2019-02-14 22:57:18 156
原创 1076 Forwards on Weibo (30 分)bfs
2019年2月14日21:58#include <iostream>#include <vector>#include <cstring>#include <queue>using namespace std;const int maxn = 2e3 +5;vector<int> a[maxn];...
2019-02-14 21:59:40 168
原创 1075 PAT Judge
2019年1月29日15:52where partial_score_obtained is either -1 if the submittion cannot even pass the compiler#include <iostream>#include <cstdio>#include <cstring>#include...
2019-02-14 20:28:13 90
原创 1074 Reversing Linked List
2019年1月29日15:45题目都读错了。。。#include <iostream>#include <vector>#include <cstdio>using namespace std;typedef struct P{ int x; int no, ne;}P;struct P y;...
2019-02-13 20:55:39 183
原创 1082 Read Number in Chinese (25 分)
2019年2月13日1:03#include <iostream>#include <vector>#include <algorithm>#include <string>using namespace std;int main(){ string s; string c[11] ...
2019-02-13 01:04:32 113
原创 1080 Graduate Admission (30 分)
2019年2月8日22:241.一个数组存学习名额2.一个结构体数组存学生信息3.排序4.从高到低选择,名额减一,二维数组记录信息,如果学校名额变为0,记录最后一个学生信息(结构体数组),要是排名一样学生选择,任然计入#include <iostream>#include <vector>#include <algorithm>...
2019-02-12 21:47:05 191
原创 1083 List Grades (25 分)
#include <iostream>#include <vector>#include <algorithm>using namespace std;typedef struct P{ string name, no; int g;}P;vector<P> p;P x;bool cmp(P a, P b){ ...
2019-02-09 22:58:24 93
原创 1081 Rational Sum (20 分)
#include <iostream>#include <cstdio>using namespace std;const long long maxn = 105;typedef struct P{ long long z, m;}P;P p[maxn];long long gcd(long long a, long long b){ ...
2019-02-08 23:12:00 150
原创 1079 Total Sales of Supply Chain (25 分)dfs or bfs
2019年2月8日13:59#include <iostream>#include <map>#include <vector>#include <cstring>#include <cstdio>#include <queue>using namespace std;const int ...
2019-02-08 19:25:46 139
原创 1078 Hashing (25 分)
2019年2月8日13:121.素数init2.数组正向增加的二次方探查法 H(key)=(key+i*i)%tsize#include <iostream>#include <vector>#include <cstring>#include <cstdio>using namespace std;co...
2019-02-08 18:18:35 180
原创 1077 Kuchiguse (20 分)
2019年2月8日16:35#include <iostream>#include <string>#include <cstdio>#include <vector>#include <stack>using namespace std;string str, s1;vector<str...
2019-02-08 16:42:07 163
原创 1052 Linked List Sorting (25 分)
2019年2月3日23:24 #include <iostream>#include <algorithm>#include <vector>#include <string>const int maxn = 1e5 + 5;using namespace std;typedef struct P{ ...
2019-02-03 23:30:22 114
原创 1051 Pop Sequence (25 分)
2019年2月3日21:39#include <iostream>#include <stack>#include <algorithm>#include <cstdio>using namespace std;const int maxn = 1005;int main(){ int n, m, k, ...
2019-02-03 21:40:11 179
原创 1068 Find More Coins (30 分)
2019年2月3日10:0801背包#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>using namespace std;int dp[10005][105], flag[10005][105];int da...
2019-02-03 10:09:58 127
原创 1067 Sort with Swap(0, i) (25 分)
2019年2月2日20:21#include <iostream>#include <vector>#include <algorithm>using namespace std;vector<int> data;int main(){ int n, x, s, t; while(cin >...
2019-02-02 20:23:53 150
原创 1065 A+B and C
想用string模拟大数加减,把自己写晕了#include <iostream>#include <cstdio>#include <cmath>using namespace std;int main(){ //cout << pow(2, 63) << endl; long lo...
2019-02-02 16:38:18 165
原创 1063 Set Similarity (25 分)
1.mapfind用法:for(it1 = data[n1].begin(); it1 != data[n1].end(); it1++){ if(data[n2].find(it1->first) != data[n2].end()) ans += 1;}#include <iostream>#include <map...
2019-02-01 19:11:15 99
原创 1071 Speech Patterns (25 分)
/**1、getline(cin, ans)输入2、map遍历 for(iter = s.begin(); iter != s.end(); iter++) {if(iter->second > Max){Max = iter->second;sss = iter->first;}}!!!处考虑到input:ca...
2019-01-31 20:35:44 101
原创 1070 Mooncake
注释解决段错误/*14:50-15:11*/#include <iostream>#include <algorithm>#include <cstdio>using namespace std;const int maxn = 1005;typedef struct P{ double a, b, c;}P;P p[maxn...
2019-01-31 19:29:57 76
原创 1069 The Black Hole of Numbers
数字输入,字符串会TE#include <iostream>#include <algorithm>#include <cstring>#include <cstdio>using namespace std;int quick(int a, int b){ int c = 1; while(b)...
2019-01-31 18:59:32 131
原创 1062 Talent and Virtue
2019年1月31日9:29尽量用scanf输入#include <iostream>#include <vector>#include <algorithm>#include <cstdio>using namespace std;struct P{ int ID_Number, Virtue_...
2019-01-31 09:35:52 80
原创 1061 Dating
2019年1月26日11:093485djDkxh4hhGE2984akDfkkkkggEdsbs&hgsfdkd&Hyscvnm1.找出三个字符;2.输出代表含义;#include <iostream>#include <vector>#include <cstring>#include <c...
2019-01-28 13:59:44 120
原创 1059 Prime Factors
2019年1月26日10:25分解素因子1.素数打表1e62.循环考虑1的输出#include <iostream>#include <vector>#include <cstring>using namespace std;typedef long long LL;const int maxn = 1e6 +5;...
2019-01-28 13:58:30 80
原创 1058 A+B in Hogwarts
2019年1月26日9:36 (Galleon is an integer in [0,107], Sickle is an integer in [0, 17), and Knut is an integer in [0, 29)).Input: 3.2.1 10.16.27Output: 14.1.28方法:1.两个数组储存in,一个存out; ...
2019-01-28 13:46:53 151
原创 1057 Stack
方法一:树状数组<思路:解此题的过程可谓是一波三折。开始的想法很天真,在每次需要PeekMedian的时候,将栈中元素全部拷贝到一个辅助数组,然后对该数组进行排序,很容易找到中间值,时间复杂度为 O((n^2) lgn),很显然最后超时了。 由于题目说明数据范围为 1~100000,想到了用一个count[]数组来储存每一个数在栈中的个数,然后每一次通过遍历数组累积,当 ...
2019-01-25 21:58:17 125
原创 1056 Mice and Rice
图来源:https://www.cnblogs.com/grglym/p/7808348.html#include <iostream>#include <queue>using namespace std;const int maxn = 1e3 + 5;typedef struct P{ int w, r;}P;int...
2019-01-25 21:55:02 109
原创 1055 The World's Richest
cin改成scanf#include <iostream>#include <algorithm>#include <cstring>#include <cstdio>using namespace std;const int maxn = 1e5 +5;typedef struct P{ char nam...
2019-01-25 21:53:16 87
原创 1054 The Dominant Color
注意:A strictly dominant color takes more than half of the total area. 找出出现次数大于n*m的数字方法一:map,统计次数#include <iostream>#include <map>#include <cstdio>using namespace st...
2019-01-25 21:48:18 106
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人