- 博客(222)
- 收藏
- 关注
原创 PAT A Level(甲级) 秋季 2021年09月11日 题解
写在前面所有题目大意和名字纯楼主脑记,准确还要看网上的题,但代码都没问题。这次最大的问题竟然是读题不认真,7-1和7-3一直没过,后来看代码没问题,重新读题发现求的方向不对,改正后即A了。7-1 数组与链表知识点:模拟题意:大致是描述了一种数据结构,是数组和链表的结合,告诉你几个顺序相连数组的初始地址和大小,然后查询编号是q的数字的地址,如果这个数组链表装不下,则输出Illegal Access.最后一行输出需要建立的数组的最小个数.注意:即使所有的查询都不成立,也要建立1个,因为最初至
2021-09-11 23:25:46
349
原创 简单的面部识别 + 语音播报打卡系统 附全部代码
库依赖face_recognition==1.3.0pypinyin==0.40.0numpy==1.16.2opencv_python==4.1.2.30PyMySQL==0.9.3pyttsx3==2.90PyQt5==5.15.2face_recognition 面部识别库pyttsx3 语音播报库PyQt5 UI设计库全部包含在 requestments.txt 中,目录下运行以下代码即可批量安装pip install -r requirements.txt使用流程
2021-02-06 00:14:47
926
原创 Educational Codeforces Round 103 (Rated for Div. 2)题解
写在前面:这次打出4道,其中C题是赛后补题,我把它想的太难了,一直想用dfs或者图论解决,结果最后看别人的AC代码发现只要观察规律即可,还有B题最后因为没有lld输出导致错误4发,很不应该。A. K-divisible Sum思路:简单的签到题,n个数相加能够整除k,求n个数中最大的数最小时的值,其实就是求一下n个数相加能整除k时的和,然后平均给n个数,求出每个数的值,如果还有余数就+1。#include <bits/stdc++.h> using namespace std;.
2021-01-30 01:07:59
477
原创 PYQT5 Qt designer生成py文件运行结果和设计不一致解决办法
设计运行结果解决办法from PyQt5 import QtCoreQtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling)
2020-11-12 11:18:54
1125
1
原创 基于神经网络的手写数字识别(模型)
minist数据集import numpy as npfrom PIL import Imagedef load_mnist(): # 读取离线的MNIST.npz文件。 path = r'mnist.npz' # 放置mnist.py的目录,这里默认跟本代码在同一个文件夹之下。 f = np.load(path) x_train, y_train = f['x_train'], f['y_train'] x_test, y_test = f['x_test']
2020-09-25 12:20:06
1145
2
原创 C++ map 遍历
迭代器遍历:// it->first map的key// it->second map的valuemap<string, string>mp;for (auto it = mp.begin(); it != mp.end(); ++it){ cout << it->first << it->second << endl;}
2020-08-26 08:46:03
525
原创 E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用) E: 无法获取 dpkg 前端锁
报错E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它?解决sudo rm -r -f /var/lib/dpkg/lock-frontendsudo rm -r -f /var/lib/dpkg/lock...
2020-08-25 09:45:55
230
1
原创 PTA(A)1074 Reversing Linked List (25point(s))(坑)
思路:最后一个点是坑,可能存在孤立点。代码:#include <iostream>#include <algorithm>#include <vector>#include <cstdio>using namespace std;struct node { int address, next; int data;} mp[100005];vector<node>a;int main(){ in.
2020-06-01 23:58:52
699
原创 PTA(A)1067 Sort with Swap(0, i) (25point(s))
思路:找到一个不在位置上的数字,每次先通过0把一些数字归位,如果当前还没归位,就把9换到对应位置上。代码:#include <bits/stdc++.h>#include <cstdio>using namespace std;int pos[100005];int main(){ int n; cin >> n; for (int i = 0; i < n; ++i) { int num;.
2020-06-01 23:56:54
186
原创 PTA(A)1013 Battle Over Cities (25point(s))
思路:并查集建边,找孤立点,总数-2.代码: #include <bits/stdc++.h> using namespace std; #define M 1000005 #define N 1005 int f[N]; int a[M], b[M], k; int n, m; void init() { for (int i = 1; i <= n; ++i) .
2020-06-01 23:53:23
220
原创 PTA(A)1015 Reversible Primes (20point(s))
思路:判断原数字是不是质数,然后按照进制逆序后判断是不是质数。代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;bool isPrime(ll x){ if (x == 1) return false; if (x == 2) return true; for (int i = 2; i <= sqrt(x); ++i) if (x % i =.
2020-06-01 23:50:35
172
原创 PTA(A)1019 General Palindromic Number (20point(s))
思路:变成对应的进制,然后判断是不是回文数。代码:#include <bits/stdc++.h>using namespace std;typedef long long ll;int main(){ ll n, b; cin >> n >> b; vector<ll>v; while (n) { v.push_back(n % b); n /= b; .
2020-06-01 23:47:50
164
原创 PTA(A)1137 Final Grading (25point(s))(模拟)
思路: 模拟即可。代码:#include <bits/stdc++.h>#include <cstdio>using namespace std;struct node { string name; int gp = -1; int gmid = -1; int gfinal = -1; int g = -1;};set<string>peo_name;map<string, node>peo_d.
2020-06-01 23:45:01
187
原创 PTA(A)1148 Werewolf - Simple Version (20point(s))(模拟)
思路: 遍历两个设为狼,然后根据发言,判断撒谎者。符合要求的就输出。代码:#include <bits/stdc++.h>#include <cstdio>using namespace std;int a[101];int main(){ int n; cin >> n; int f = 0; for (int i = 1; i <= n; ++i) { cin >> a[.
2020-06-01 23:42:53
349
原创 2020年第十四届山东大学程序设计竞赛(重现赛)题解(C D F L)
#include <iostream>#include <string>using namespace std;int main(){ string a, b = "", c = ""; cin >> a; for (int i = 0; i < a.size(); ++i) { if (i % 2 == 0) b += a[i]; else .
2020-05-30 19:31:11
794
原创 PAT(A)1010 Radix (25point(s))
思路:这是我看过的测试点最多的题,简直多到爆。看到题面,意识上认为只有36进制就可以了,然而不是,注意爆long long时会变成负数,然后还有,暴力不行,一定要二分找,下界是n2的最低阶,上界是n1的数值和n2的最低阶比较的较大值。这张图真是贼不容易。代码:#include <bits/stdc++.h>#include <cstdio>using n...
2020-05-04 16:58:19
199
原创 PAT(A)1088 Rational Arithmetic (20point(s))
Sample Input2/3 -4/2Sample Output2/3 + (-2) = (-1 1/3)2/3 - (-2) = 2 2/32/3 * (-2) = (-1 1/3)2/3 / (-2) = (-1/3)思路:模拟就行,情况比较多,写一个函数会比较好。代码#include <bits/stdc++.h>#include <cst...
2020-05-03 22:33:05
167
原创 Codeforces Round #636 (Div. 3)题解
A. Candiestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently Vova found n candy wrappers. He remembers that he bought x candies during t...
2020-04-22 08:08:58
1212
原创 PAT(A)1071 Speech Patterns (25point(s))
思路: 统计次数最多且字典序最小的单词。#include <bits/stdc++.h>using namespace std;typedef long long ll;#define endl '\n'vector<string>v;map<string, int>mp;int main(){ string str; ...
2020-04-19 10:02:10
184
原创 传染病动力学模型 SI => SIS => SIR => SEIR(python)
Parameter# parameterN = 10000 # HeadcountI = 1 # The InfectedS = N - I # SusceptibleE = 0 # ExposedR = 0 # Recoverr = 10 # Number of people per infected person per day.r2 = 10B = 0.01 # Trans...
2020-04-14 11:42:39
4820
4
原创 Codeforces Round #634 (Div. 3)题解
写在前面: 还是只有四道。。。想出了后两道解法但来不及了,主要是第四道耗时太久。下次碰到类似的要找准方法,直接写。A. Candies and Two Sisterstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are...
2020-04-14 08:24:03
932
原创 PAT(A)1079 Total Sales of Supply Chain (25point(s))(dfs)
Sample Input10 1.80 1.003 2 3 51 91 41 70 72 6 11 80 90 40 3Sample Output42.4思路:深搜到叶,然后算总的售卖数即可。代码#include <bits/stdc++.h>using namespace std;typedef long long ll;#def...
2020-04-13 14:03:29
140
原创 PAT(A)1092 To Buy or Not to Buy (20分)
Sample InputppRYYGrrYBR2258YrR8RrYSample OutputYes 8思路:模拟即可,找准数目。代码#include <bits/stdc++.h>using namespace std;typedef long long ll;#define endl '\n'string a, b;map<char,...
2020-04-13 13:36:17
156
原创 PAT(A)1060 Are They Equal (25分)(模拟)
Sample Input3 12300 12358.9Sample OutputYES 0.123*10^5思路:这题模拟的情况式真的多!!!小数前导0负指数简直了。代码#include <bits/stdc++.h>using namespace std;typedef long long ll;#define endl '\n'int ...
2020-04-13 13:08:29
132
原创 Codeforces Round #633 (Div. 2)题解
思路: 因为怕暴力算法TLE,然后上网搜了简便的,没想到居然简便算法有误。。。暴力算法反而过了。。。A. Filling Diamondstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have integer n. Cal...
2020-04-13 09:01:25
697
原创 Educational Codeforces Round 85 (Rated for Div. 2)题解
写在前面: 没想到思路全对的情况下居然因为一个初始化错误卡了一个多小时没出来。。。A. Level Statisticstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPolycarp has recently created a...
2020-04-12 10:51:35
479
原创 PAT(A)1082 Read Number in Chinese (25分)
Sample Input-123456789Sample OutputFu yi Yi er Qian san Bai si Shi wu Wan liu Qian qi Bai ba Shi jiu思路:题目不难,模拟比较多。第三个点是只输入0.代码#include <bits/stdc++.h>using namespace std;string n...
2020-04-11 23:13:02
151
原创 Codeforces Round #631 (Div. 2) - Thanks, Denis aramis Shitov!题解
写在前面: 只过了2题,希望以后能真真实实过多一点!!!A. Dreamoon and Ranking Collectiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputDreamoon is a big fan of the C...
2020-04-04 16:16:16
791
1
原创 二叉树的遍历(先中后层)
1、先序遍历(NLR, Preorder Traversal)根 —> 左 —> 右2、中序遍历(LNR, Inorder Traversal)左 —> 根 —> 右3、后序遍历(LRN, Postorder Traversal)左 —> 右 — > 根4、层序遍历按层,每层从左到右...
2020-04-03 21:51:11
336
原创 Vue学习(10)生命周期
<!-- * @Author: your name * @Date: 2020-04-02 17:20:30 * @LastEditTime: 2020-04-02 18:44:27 * @LastEditors: Please set LastEditors * @Description: 组件的生命周期 * @FilePath: \x\13.html --><...
2020-04-02 18:54:57
228
原创 PAT(A)1113 Integer Set Partition (25分)
Sample Input1023 8 10 99 46 2333 46 1 666 555Sample Output0 3611思路:1、min( |n1 - n2| ) —> 平分整个数组2、max( |s1 - s2| ) —> 排序一下,大的一半一组,小的一组,最后相减代码#include <bits/stdc++.h>using na...
2020-04-02 17:11:43
146
原创 PAT(A)1106 Lowest Price in Supply Chain (25point(s))(深度优先搜索)
Sample Input10 1.80 1.003 2 3 51 91 41 702 6 11 8000Sample Output1.8362 2思路:最快乐就是看到全AC,和前面有一道题几乎一模一样,就是深搜求最小深度,然后统计同深度的叶子数目。开始没看到是同一棵树,还以为是森林。。。审题很重要!!!代码#include <bits/stdc+...
2020-04-02 00:23:02
130
原创 Vue学习(9)计算属性
computed 实时监听<!-- * @Author: your name * @Date: 2020-04-01 17:20:57 * @LastEditTime: 2020-04-01 19:38:33 * @LastEditors: Please set LastEditors * @Description: 计算属性 * @FilePath: \x\12.html ...
2020-04-01 19:40:48
220
原创 Vue学习(8)监视器
watch简单监视 单个属性 简单数据结构深度监视 复杂属性 复杂数据结构<!-- * @Author: your name * @Date: 2020-04-01 16:50:28 * @LastEditTime: 2020-04-01 17:11:06 * @LastEditors: Please set LastEditors * @Description: 监听(内存...
2020-04-01 17:14:24
345
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人