随笔分类 -  PTA程序设计

摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int maxn = 1010; struct mouse{ int weight;//质量 int R;//排名 }mous 阅读全文
posted @ 2020-01-18 12:06 JasonPeng1 阅读(155) 评论(0) 推荐(0)
摘要:解法1:(自己码的) #include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAXN = 10000; stack<int> stk; int main(){ int M, 阅读全文
posted @ 2020-01-17 23:37 JasonPeng1 阅读(144) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; //5个map变量分别建立书名,作者,关键词,出版社及出版年份与id的映射关系 map<string,set<int>> mpTitle, 阅读全文
posted @ 2020-01-17 11:43 JasonPeng1 阅读(140) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int maxn = 480005;//最大学生人数 map<int,int> temp; int main(){ int m 阅读全文
posted @ 2020-01-17 10:22 JasonPeng1 阅读(92) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int maxn = 40010;//最大学生人数 bool check(char c){ if(c >= '0' && c< 阅读全文
posted @ 2020-01-16 22:11 JasonPeng1 阅读(155) 评论(0) 推荐(0)
摘要:用了打表的技巧 #include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int maxn = 40010;//最大学生人数 //[0,12]的火星文 string unitDigit 阅读全文
posted @ 2020-01-16 21:33 JasonPeng1 阅读(257) 评论(0) 推荐(0)
摘要:超时主要是这个语句的原因: for(iter = temp[num1].begin();iter != temp[num1].end();++iter){ for(iter1 = temp[num2].begin();iter1 != temp[num2].end();++iter1){ if(*i 阅读全文
posted @ 2020-01-16 13:04 JasonPeng1 阅读(234) 评论(0) 推荐(0)
摘要:没有想到以二维数组 char [N][5] 存放输入的姓名,自己尝试用vector<char> 失败了。 小技巧:如果排序时直接对字符串排序,那么会导致大量的字符串移动,非常耗时间,因此比较合适的做法是使用字符串的下标来代替字符串本身进行排序,这样消耗的时间会少得多 strcmp 的返回值不一定是 阅读全文
posted @ 2020-01-15 23:43 JasonPeng1
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int N = 40005; //vector<vector<int>> const int M = 26*26*26*10 阅读全文
posted @ 2020-01-15 18:31 JasonPeng1 阅读(132) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAXN = 100005; //const int MOD = 1000000007; const int INF 阅读全文
posted @ 2020-01-15 15:12 JasonPeng1
摘要:暴力: #include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int N = 100005; long int temp[N]; int main(){ char temp[N]; 阅读全文
posted @ 2020-01-14 21:03 JasonPeng1 阅读(131) 评论(0) 推荐(0)
摘要:并没有用到双指针遍历 #include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int N = 2000005; long int temp[N]; int main(){ int c 阅读全文
posted @ 2020-01-14 17:54 JasonPeng1
摘要:插入排序: #include <string> using namespace std; const int N = 111; //插入排序 int temp[N]; int main(){ int n; cin>>n; for(int i=0;i<n;++i){ cin>>temp[i]; } i 阅读全文
posted @ 2020-01-14 14:05 JasonPeng1
摘要:二重循环枚举 #include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAX_LEN = 100005; bool cmp(int a,int b){ return a<b; 阅读全文
posted @ 2020-01-13 09:26 JasonPeng1
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAX_LEN = 100005; bool cmp(double a,double b){ return a > b 阅读全文
posted @ 2020-01-10 18:33 JasonPeng1
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAX_LEN = 100005; int main(){ int temp[10]; for(int i =0;i< 阅读全文
posted @ 2020-01-08 21:36 JasonPeng1
摘要:思路: two pointers #include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAX_LEN = 100005; bool cmp(int a,int b){ r 阅读全文
posted @ 2020-01-07 18:18 JasonPeng1
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAX_LEN = 10005; int main(){ char fir[MAX_LEN]; char sec[MA 阅读全文
posted @ 2020-01-07 16:51 JasonPeng1 阅读(99) 评论(0) 推荐(0)
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAX_LEN = 10005; int main(){ int n; cin>>n; int temp[MAX_LE 阅读全文
posted @ 2020-01-07 16:35 JasonPeng1
摘要:#include <bits/stdc++.h> #include<math.h> #include <string> using namespace std; const int MAX_LEN = 10005; //char str[MAX_LEN]; //int hashTable[30] = 阅读全文
posted @ 2020-01-07 14:22 JasonPeng1 阅读(163) 评论(0) 推荐(0)