- 博客(91)
- 收藏
- 关注
原创 解决ModuleNotFoundError: No module named ‘pip‘问题
该问题可通过依次输入这两行代码解决。python -m ensurepippython -m pip install --upgrade pip参考链接:https://blog.youkuaiyun.com/haihonga/article/details/100168691
2021-01-23 21:04:55
193
原创 竞赛评分
#include <iostream>#include <algorithm>#include <cstring>using namespace std;const int N = 3;struct Node{ int score, id; //内嵌式的比较函数速度更快 bool operator <(const Node &a) const{ return score == a.score ? id < a.id : sco
2020-11-01 10:14:47
179
原创 取模运算总结
(a + b) % p = (a % p + b % p) % p(a - b) % p = ((a % p - b % p) + p) % p(a * b) % p = (a % p) * (b % p) % p
2020-10-03 17:05:46
285
原创 产生冠军(set)
#include <iostream>#include <string>#include <set>using namespace std;int main(){ int n; while(cin >> n && n) { string win[1000], lose[1000]; set<string> s; for(int i = 0; i < n; i ++) { cin >
2020-09-27 15:29:50
172
原创 A + B
#include <iostream>#include <string>#include <map>using namespace std;//不要害怕字符串处理(*^▽^*)int main(){ string str; map<string, int> mp; mp["zero"] = 0, mp["one"] = 1, mp["two"] = 2, mp["three"] = 3, mp["four"] = 4, mp["five"]
2020-09-27 15:17:48
173
原创 SORT AGAIN
#include <iostream> #include <string.h>using namespace std;//用到了hash表以空间换时间的思想const int N = 1005;const int K = 2005;int main(){ int c, n, k, t; cin >> c; while(c --) { int a[N], b[K]; memset(b, 0, sizeof(b)); scanf("%d%d
2020-09-26 10:52:47
120
原创 Sequence Median
#include <iostream>#include <algorithm> #include <vector>using namespace std;/*Each element of the sequence is a positive integer not greater than 2^32 - 1 inclusive.n为偶数时,如果把两个数相加再除以2,会溢出(大坑)*/int main(){ int n, k; while(~sca
2020-09-26 09:38:03
191
原创 shǎ崽 OrOrOrOrz
Acmer in HDU-ACM team are ambitious, especially shǎ崽, he can spend time in Internet bar doing problems overnight. So many girls want to meet and Orz him. But Orz him is not that easy.You must solve this problem first.The problem is :Give you a sequence .
2020-09-25 08:35:28
123
转载 出现Presentation Error的解决方法
有时候在电脑上写的程序运行成功,但在OJ平台上却会提示Presentation Error。1.思路是对的,且运行时间符合要求2.答案和标准结果非常接近,也就是说最可能是因为,在输出结果中,多了或少了不必要的空格或者回车或者其他,总而言之,OJ平台对格式的检查非常严格,所以一定要认真检查程序的输出结果是否与标准一致。...
2020-09-25 08:32:33
2937
原创 Number Steps
Starting from point (0,0) on a plane, we have written all non-negative integers 0, 1, 2,... as shown in the figure. For example, 1, 2, and 3 has been written at points (1,1), (2,0), and (3, 1) respectively and this pattern has continued.You are to write
2020-09-25 08:09:15
203
原创 Clock(排序)
There is an analog clock with two hands: an hour hand and a minute hand. The two hands form an angle. The angle is measured as the smallest angle between the two hands. The angle between the two hands has a measure that is greater than or equal to 0 and le
2020-09-24 22:37:37
187
原创 As Easy As A+B
These days, I am thinking about a question, how can I get a problem as easy as A+B? It is fairly difficulty to do such a thing. Of course, I got it after many waking nights.Give you some integers, your task is to sort these number ascending (升序).You shou
2020-09-24 21:07:13
183
原创 排名
今天的上机考试虽然有实时的Ranklist,但上面的排名只是根据完成的题数排序,没有考虑每题的分值,所以并不是最后的排名。给定录取分数线,请你写程序找出最后通过分数线的考生,并将他们的成绩按降序打印。INPUT测试输入包含若干场考试的信息。每场考试信息的第1行给出考生人数N ( 0 < N< 1000 )、考题数M ( 0 < M < = 10 )、分数线(正整数)G;第2行排序给出第1题至第M题的正整数分值;以下N行,每行给出一名考生的准考证号(长度不超过20的字符串
2020-09-21 20:05:14
348
原创 排序
输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数就是0)。你的任务是:对这些分割得到的整数,依从小到大的顺序排序输出。
2020-09-21 18:04:57
138
原创 PAT B.1039 到底买不买 (20分)
#include <iostream>#include <string>#include <map>using namespace std;int main(){ map <char, int> mp; string store, cus; int a = 0; //a表示缺少的 cin >> store >> cus; for(int i = 0; i < store.length(); i ++) {
2020-09-13 09:29:00
103
原创 PAT B.1030 完美数列 (25分)
#include <iostream>#include <vector>#include <algorithm>using namespace std;typedef long long LL;int main(){ int n, ans = 0, temp = 0;//ans记录完美数列的最大长度 LL p, k;//注意数据类型 vector <LL> v; cin >> n >> p;
2020-09-13 09:00:44
114
原创 PAT B. 1028 人口普查 (20分)
#include <iostream>using namespace std;int main(){ int n, cnt = 0;//cnt记录有效生日的个数 string name, str, maxdate, mindate, max, min; maxdate = "2014/09/06", mindate = "1814/09/06"; cin >> n; while(n --) { cin >&
2020-09-13 08:28:27
119
原创 vscode c++ 运行结束窗口一闪而过
#include <iostream>using namespace std;int main(){ cout << "Hello" << endl; system("pause");//加上这一句即可 return 0;}
2020-09-10 16:37:31
2536
原创 python编程出现:expected an indented block错误
expected an indented block意为:期待一个缩进块错误原因:缩进不规范,少些或多些了一个空格(python一定要注意缩进规范)i = 0while i < 10: print(i) i = i + 1
2020-08-26 13:02:22
17184
原创 CCF 202006-2 稀疏向量(100)
#include <iostream>#include <map>using namespace std;typedef long long LL;map <int, int> mp;int main(){ ios::sync_with_stdio(false);//cin<<scanf<cin(关闭流同步)此处是关键!!!使用了这一句就不要用scanf和printf啦! int n, a, b, index, value; L
2020-08-20 17:06:00
309
原创 CCF 201409-1 相邻数对
代码1(朴素版~)#include <iostream>#include <math.h>using namespace std;const int N = 1005;int a[N];int main(){ int n, ans = 0; cin >> n; for(int i = 0; i < n; i ++) { cin >> a[i]; } for(int i =
2020-08-08 16:07:39
103
原创 PAT B.1023 组个最小数 (20分)
/*组个最小数*/#include <iostream>#include <queue>using namespace std;int main(){ queue<int> a; queue<int> b; //存放0 int n, t; for(int i = 0; i < 10; i ++) { cin >> n; while(n--){ a.push(i); } } t = a.size(
2020-07-31 11:07:35
126
原创 PAT B.1021 个位数统计 (15分)
/*个位数统计*/#include <iostream>#include <string>#include <map>using namespace std;int main(){ string s; cin >> s; map<int, int> mp; for(int i = 0; i < s.length(); i ++) { mp[s[i]-'0'] ++; } for(map<int, in
2020-07-29 10:55:42
121
原创 PAT B. 1019 数字黑洞 (20分)
代码1:/*数字黑洞*/#include <iostream>#include <algorithm>#include <string>using namespace std;bool cmp(char a, char b){ return a > b;}int main(){ string str; int temp; cin >> str; str.insert(0, 4-str.length(), '0');//
2020-07-29 10:39:22
147
原创 PAT B.1017 A除以B (20分)
/*A除以B */#include <iostream>#include <string>using namespace std;int main(){ string s; int n, q, r; cin >> s >> n; q = (s[0] - '0') / n;//模拟除法,第一位要特殊考虑 r = (s[0] - '0') % n; if(q != 0 || s.length() == 1)// 输入为8 9时,应输出0 8
2020-07-27 13:05:21
98
原创 CCF 202006-1 线性分类器
代码1:正常思路+STL/*线性分类器*/#include <iostream>#include <vector>using namespace std;typedef long long LL; //此处是关键struct point{ int xn, yn; char c;};vector<point> a; //存储A类点vector<point> b; //存储B类点int main(){ int n, m, cnta
2020-07-27 11:19:16
799
原创 PAT B.1052 卖个萌 (20分)
#include <iostream>#include <vector>#include <string>using namespace std;int main(){ vector<vector<string> >v;//创建vector类型的二维数组 string s; for(int i = 0; i < 3; i ++) { getline(cin, s); vector<string> p;
2020-07-27 10:20:58
93
原创 PAT B.1015 德才论 (25分)
/*德才论*/#include <iostream>#include <algorithm>#include <vector>using namespace std;struct person{ int id, dscore, cscore, sum;};vector<person> stu[4];bool cmp(struct person a, struct person b){ if(a.sum != b.sum){ ret
2020-07-24 10:08:26
97
原创 PAT B.1013 数素数 (20分)
/*数素数*/#include <iostream>#include <math.h>#include <vector>using namespace std;//判断是否为素数bool isprime(int n){ for(int i = 2; i <= sqrt(n); i ++) { if(n % i == 0) return false; } return true;}int main(){ int m, n, num
2020-07-23 10:12:39
101
原创 PAT B.1092 最好吃的月饼 (20分)
/*最好吃的月饼*/#include<iostream>#include<algorithm> using namespace std;const int N = 1000 + 5;int a[N];int main(){ int n, m, v, maxn = 0, flag = 0; cin >> n >> m; while(m --) { for(int i = 0; i < n; i ++) { cin &
2020-07-20 10:57:17
178
原创 CCF 201912-2 回收站选址
#include<iostream>#include<map>#include<string.h> using namespace std;const int N = 1000;int count[5];pair<int, int> p[N];int main(){ int n; map<pair<int, int>, int> ps; cin >> n; for(int i = 0; i &
2020-06-27 10:10:28
127
原创 CCF 201912-1 报数
#include<iostream>using namespace std;int a[5] = {0};int main(){ int n; int count = 0; cin >> n; for(int i = 1; ; i ++) { //判断是否为7的倍数或者是否含有7 if(i % 7 == 0 || i % 10 == 7 || i / 10 % 10 == 7 || i / 100 == 7) { a[i%4] ++; //找
2020-05-13 13:56:20
155
原创 warning:control may reach end of non-void function
出现这句警告表明:本应带有返回值的函数到达结尾后可能并没有返回任何值。
2020-05-09 16:23:17
225
原创 使用jquery清空input 文本框中的内容
$('.clear').click(function(){ $(".input").val(""); })在点击清空按钮时,将输入框的值置空。
2020-02-24 10:12:40
3077
原创 Uncaught SyntaxError: Unexpected end of input
Unexpected end of input 的英文意思是“意外的终止输入”他通常表示我们浏览器在读取我们的js代码时,碰到了不可预知的错误,导致浏览器无法进行下面的读取通常造成这种错误的原因是应该成双的符号输入错误,比如说""''{}[]...
2020-02-19 17:31:29
1854
原创 升级pip超时
使用 豆瓣源进行安装 pippython -m pip install --upgrade pip -ihttp://pypi.douban.com/simple --trusted-host pypi.douban.com
2020-02-16 18:02:05
154
原创 A.1056 Mice and Rice
#include<stdio.h>#include<queue>using namespace std;const int maxn = 1000 + 10;struct mouse{ int weight;//老鼠的重量 int Rank;//老鼠的排名 }a[maxn];int main(){ queue<int> q; int np...
2019-11-30 22:27:25
111
原创 B.1020 月饼
题目中说的月饼的库存量和总售价是正数,没说是正整数,嘤嘤嘤,经验的主观带入实在可怕!!!明明离满分辣么近~#include<stdio.h>#include<algorithm>using namespace std; struct node{ double num;//该月饼的库存量 double totalprice;//该月饼的总售价 double ...
2019-11-27 18:15:32
157
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人