自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(82)
  • 收藏
  • 关注

原创 从零到一深度学习环境搭建(双系统Ubuntu22.04+PyTorch+PyCharm/vscode+一些杂项)

ubuntu(22.04)https://blog.csdn.net/m0_51233386/article/details/120918319推荐安装比较近的版本,比如现在18.04就太老了…我重装了一次,目前用的是22.04(写于2022.05),之前考虑的是新版本可能教程比较少,但我没想到早年版本很有可能不适配新买的电脑(主要是显卡)。而且很多操作超级麻烦。另外空间分配一定要能多大就多大,后面的docker什么的一个就是六七个G。配置root账户https://blog.csdn.net/y

2022-05-04 21:57:53 3077 1

原创 阿里云服务器部署+docker学习

假设我们有一个服务器 ip xxx.xxx.xxx.xxx 密码 xxxxx 用户 root并且有一个项目hello-world,现在需要使用ssh+docker把它搬到服务器上。远程连接服务器ssh root@xxx.xxx.xxx.xxx !ssh #非第一次连接可用,会自动使用上次ssh的用户名和ip然后按照提示输入密码xxxxx,就可以通过终端操作服务器了。本机和服务器之间的数据传输语法和栗子:scp 本机源路经 用户名@ip:目标路径scp hello-world.zip r

2022-04-19 12:28:58 1370

原创 浙江大学2022机试总结

其实没有什么好写的,毕竟签了保密协议又不能说题…但是实在不想复习面试了来摸摸鱼(理直气壮)今年PAT不能抵机试了!气!还好我机试也是满分/滑稽介绍一点新发现的好用技巧好了:1.用什么数组加memset,用vector不香吗,我去年九月写的什么鸟玩意。2.用什么sort,用priority_queue不香吗,我去年九月写的什么鸟玩意。3.上面两个数据结构可能要配合pair使用4.上面两个东西都是打leetcode周赛看大佬代码学到的,推荐大家,如果知识点都知道但是写的很慢的话,没事玩玩周赛。(说起

2022-03-26 12:10:25 2870 9

原创 浙计考研初试总结(11408)

初试成绩:406(政治64,英语85,数学124,408 133),还可以了今年够用了2333,写一下经验和踩的坑。首先最重要的,考研复习一定要根据自己的情况来制定!每个人每门课悟性不一样不可一概而论!参考经验时一定要想想清楚和自己情况是否相似。我是浙本,小小跨考,本科是计院的但不学计组和操作系统,然后出来工作了一年本科学的忘得差不多了。八月份开始辞职考研,差不多五个月准备时间。政治:政治就是很典型的复习失败了…我问一个80+学长政治要背多久,他说两个星期就够了,然而!我!一个月都背不下来!政治是真

2022-03-17 14:39:48 3120 1

原创 PAT Advanced Level

满分啦,刷题博客就不更新了。遇到的题目比较简单,用了一半的时间就满分了…(索然无味鸡的感觉)20分是数组,25是栈+排序和图,30是简单的树(而且最大只有20个节点),最大的困难是题意理解错了两次。不知道是不是每一场都这样,反正比练习题简单很多,对时间卡的也很宽松没有遇到超时。可能有用的经验(踩的坑):1.能用C就用C,C肯定是亲儿子。题目的逻辑并不会很复杂,和整实际应用不一样,lua的优势不大,lua字符串处理还很麻烦经常被连词符坑,耗时又久,说不定哪就超时了。2.可以用if(…) while(t

2021-09-16 17:27:13 876

原创 给倒水小游戏写的暴力破解exe

游戏:简单的DFS搜索。这个代码一个缺点是要倒着看,另一个缺点是有两个瓶子装着同一种颜色并且可以操作时,如果在它们前面还有一个空瓶子时,会先倒进空瓶子,再倒进该倒进的瓶子。最后一个缺点是过于暴力,毫无策略(反正人类玩的十来个瓶子的场景肯定没问题)。#include <iostream>#include <vector>#include <map>using namespace std;int N, max_Volunm, not_empty;vec

2021-09-08 12:27:00 1159

原创 用LUA(和C++)刷PAT (Advanced Level) ——1092 To Buy or Not to Buy

local string1 = io.read('*l');local string2 = io.read('*l');local string1_table = {};for c in string1:gmatch('%w') do string1_table[c] = (string1_table[c] or 0) + 1endlocal missing_count = 0for c in string2:gmatch('%w') do if string1_table

2021-09-07 10:18:11 712

原创 用LUA(和C++)刷PAT (Advanced Level) ——1090 Highest Price in Supply Chain

#include <iostream>#include <vector>#include <cstring>using namespace std;double prices[100000];double price, rate;int suppliers[100000];double max_price = 0;int max_count = 0;void getPrice(int index){ if(prices[index] &gt

2021-09-05 16:10:52 698

原创 用LUA(和C++)刷PAT (Advanced Level) ——1089 Insert or Merge

#include <iostream>#include <vector>#include <algorithm>#include <cmath>using namespace std;int N;bool isInsertion(int initial[], int partially[]){ bool sorted = true; for(int i = 0; i < N; i++){ if(i &am

2021-09-05 15:53:51 711

原创 用LUA(和C++)刷PAT (Advanced Level) ——1088 Rational Arithmetic

#include <iostream>#include <string>#include <cmath>using namespace std;long int realGetMaxFaction(long int a, long int b){ if (a == 0) return b; if (b == 0) return a; if (a > b) return rea

2021-09-05 14:53:00 713

原创 用LUA(和C++)刷PAT (Advanced Level) ——1087 All Roads Lead to Rome

#include <iostream>#include <map>#include <string>#include <vector>#include <cstring>#include <cmath>#include <algorithm>using namespace std;struct city{ string name; int happiness = 0, cumulative

2021-09-04 16:24:47 711

原创 用LUA(和C++)刷PAT (Advanced Level) ——1086 Tree Traversals Again

#include <iostream>#include <vector>#include <string>using namespace std;struct node{ int left = -1, right = - 1;};node nodes[31];int N, root_id = -1, current_node = -1, current_back = -1;void printTree(int root){ if(r

2021-09-03 23:36:20 683

原创 用LUA(和C++)刷PAT (Advanced Level) ——1085 Perfect Sequence

#include <iostream>#include <vector>#include <algorithm>#include <cmath>using namespace std;int main(){ int N, P, Max = 0; cin>>N>>P; vector<long long int> numbers(N); for(int i = 0; i <

2021-09-03 22:58:29 679

原创 用LUA(和C++)刷PAT (Advanced Level) ——1084 Broken Keyboard

local input = io.read('*a')local n_pos = string.find(input, "\n")local string_o = string.upper(string.sub(input, 1, n_pos - 1))local string_t = string.upper(string.sub(input, n_pos + 1, #input - 1))local detected_map = {}local type_index = 1local res

2021-09-03 22:46:45 681

原创 用LUA(和C++)刷PAT (Advanced Level) ——1083 List Grades

#include <iostream>#include <algorithm>#include <vector>#include <string>using namespace std;struct student{ string name, id; int score;};bool comp(student a, student b){ return a.score > b.score;}int main(){

2021-09-03 22:38:16 691

原创 用LUA(和C++)刷PAT (Advanced Level) ——1082 Read Number in Chinese

local numbers = {"yi ", "er ", "san ", "si ", "wu ", "liu ", "qi ", "ba ", "jiu "}local digits = {"", "Shi ", "Bai ", "Qian "}local large_digits = {"", "Wan ", "Yi "}local input = io.read('*a')local negative = ""if string.sub(input, 1, 1) == "-" the

2021-09-03 22:24:50 696

原创 用LUA(和C++)刷PAT (Advanced Level) ——1081 Rational Sum

测试点4:结果是0时要输出一个0;#include <iostream>#include <cmath>using namespace std;long int findMaxFactor(long int a, long int b){ for(int i = 2; i <= max(a, -a) && i <= max(b, -b); i ++){ if(a % i == 0 && b % i ==

2021-09-03 21:54:39 687

原创 用LUA(和C++)刷PAT (Advanced Level) ——1080 Graduate Admission

#include <iostream>#include <vector>#include <algorithm>#include <cstring>using namespace std;struct student{ int id, Ge, Gi; int choices[5];};bool compSt(student a, student b){ if(a.Ge + a.Gi != b.Ge + b.Gi)

2021-09-03 20:25:25 717

原创 用LUA(和C++)刷PAT (Advanced Level) ——1079 Total Sales of Supply Chain

#include <iostream>#include <map>using namespace std;int suppliers[100001];//记录每个人是从谁手里进货的double suppliers_scale[100001] = {0};//记录每个人的卖出比例double price, percentage;void calculateScale(int index){ if(suppliers_scale[index])

2021-09-03 17:57:18 790

原创 用LUA(和C++)刷PAT (Advanced Level) ——1078 Hashing

布尔数组不初始化时全是false的错觉是谁给我的…记得初始化#include <iostream>#include <cstring>using namespace std;bool prime[10050];void initializePrimes(){ memset(prime, true, sizeof(bool)*10050); prime[0] = false; prime[1] = false; for(int i =

2021-09-03 17:04:21 678

原创 用LUA(和C++)刷PAT (Advanced Level) ——1077 Kuchiguse

#include <iostream>#include <string>#include <vector>using namespace std;int main(){ int n; vector<string> s(n); cin>>n; getchar(); for(int i = 0; i < n; i++) getline(cin, s[i]); strin

2021-09-03 16:01:38 76

原创 用LUA(和C++)刷PAT (Advanced Level) ——1076 Forwards on Weibo

3000毫秒也会超时啊…满分的C++:#include <iostream>using namespace std;int main(){ bool info[1001][6][1001]; int N, L, K; cin>>N>>L; for(int person_index = 1; person_index <= N; person_index++ ) for(int level = 0; lev

2021-09-02 23:14:24 73

原创 用LUA(和C++)刷PAT (Advanced Level) ——1075 PAT Judge

#include <iostream>#include <vector>#include <cmath>#include <algorithm>#include <cstring>using namespace std;struct student{ int id, grade = 0, perfect_solution = 0; bool valid = false; bool questions[5];/

2021-09-02 22:08:24 65

原创 用LUA(和C++)刷PAT (Advanced Level) ——1074 Reversing Linked List

满分C++:#include <iostream>#include <vector>#include <string>#include <map>#include <cmath>#include <algorithm>using namespace std;struct node{ int add, next_add; int content;};int main(){ int ad

2021-09-02 20:59:44 84

原创 用LUA(和C++)刷PAT (Advanced Level) ——1073 Scientific Notation

local input = io.read('*a')local Epos = string.find(input, "E")local number = string.sub(input, 1, Epos - 1) local digit = string.sub(input, Epos + 1, #input - 1)digit = ((string.sub(digit, 1, 1) == "-") and -1 or 1) * tonumber(string.sub(digit, 2, #

2021-09-02 19:47:17 76

原创 用LUA(和C++)刷PAT (Advanced Level) ——1072 Gas Station

local readF = io.read('*a'):gmatch('%w+')local N = readF() M = readF() K = readF() D = tonumber(readF())local roads = {};setmetatable(roads, {__index = function(t, v) t[v] = {} return t[v] end})local num = nil min_D = -1 ava_D = -1;function dij(numb

2021-09-02 18:10:01 70

原创 用LUA(和C++)刷PAT (Advanced Level) ——1071 Speech Patterns

#include <iostream>#include <string>#include <map>using namespace std;bool characterLegal(char& c){ if (c <= '9' && c >= '0') return true; if (c <= 'Z' && c >= 'A'){ c = c + 'a

2021-09-02 14:34:12 61

原创 用LUA(和C++)刷PAT (Advanced Level) ——1070 Mooncake

#include <iostream>#include <vector>#include <iomanip>#include <algorithm>using namespace std;struct node{ float amount; float price;};bool comp(node a, node b) { return a.price / a.amount > b.price / b.amount;

2021-09-01 23:33:03 77

原创 用LUA(和C++)刷PAT (Advanced Level) ——1069 The Black Hole of Numbers

local input = tonumber(io.read('*a'))local flag = nilwhile (input ~= 0 and input ~= 6174) or not flag do flag = true local t = {} output = "" local n1, n2 table.insert(t, math.floor(input/1000)) table.insert(t, math.floor(input/100)

2021-09-01 22:40:10 63

原创 用LUA(和C++)刷PAT (Advanced Level) ——1068 Find More Coins

#include <iostream>#include <vector>#include <algorithm>#include <string>using namespace std;string result = "";int N, pay;bool info[101][100000];int getCoin(int index, vector<int> coins){ if (pay < coins[in

2021-09-01 18:16:40 71

原创 用LUA(和C++)刷PAT (Advanced Level) ——1067 Sort with Swap(0, i)

#include <iostream>using namespace std;int main(){ int N, count = 0; int numbers[100000]; cin>>N; for(int i = 0; i < N; i++){ scanf("%d", &(numbers[i])); } int i = 0; while(true){ if (numb

2021-09-01 17:11:08 59

原创 用LUA(和C++)刷PAT (Advanced Level) ——1066 Root of AVL Tree

链表这种东西,真的很适合一个bug查一天…#include <iostream>#include <algorithm>#include <cstring>using namespace std;struct node { int key; node *parent, *left, *right; int balance = 0, height = 0;};node* root = NULL;void insert(node* root_no

2021-09-01 16:38:56 83

原创 用LUA(和C++)刷PAT (Advanced Level) ——1065 A+B and C

其实用longlong处理一下越界就好,浮点数精度不够。#include <iostream>#include <string>#include <algorithm>#include <vector>#include <cmath>using namespace std;int getDigit(int index, string s, bool flag){ if(index < 0) return 0;

2021-09-01 14:47:14 61

原创 用LUA(和C++)刷PAT (Advanced Level) ——1064 Complete Binary Search Tree

local readF = io.read('*a'):gmatch('%d+')local function readFunc() return tonumber(readF())endlocal numbers = {} tree = {} N = readFunc()for i = 1, N do table.insert(numbers, readFunc())endtable.sort(numbers, function(a, b) return a < b

2021-09-01 13:35:12 91

原创 用LUA(和C++)刷PAT (Advanced Level) ——1063 Set Similarity

local readf = io.read('*a'):gmatch('%d+')local readFunc = function() return tonumber(readf())endlocal N = readFunc() sets = {}for i = 1, N do sets[i] = {} sets[i].count = 0 local Tcount = readFunc() for j = 1, Tcount do n

2021-08-31 20:31:22 72

原创 用LUA(和C++)刷PAT (Advanced Level) ——1062 Talent and Virtue (25 分)

一杯茶,一包烟,一个j – 没写查一天。另外发现花里胡哨写了一堆,性能还没有直接排序来得强…蓝瘦,考试写链表真的想不开…#include <iostream>#include <cstdlib>#include <cstring>using namespace std;struct person{ int id, virtue, talent; person* next = NULL;}; int N, L, H, M = 0;

2021-08-31 19:13:10 75

原创 用LUA(和C++)刷PAT (Advanced Level) ——1061 Dating

不说人话的题之一。#include <iostream>#include <string>#include <vector>using namespace std;int main(){ string s1, s2, s3, s4; cin>>s1>>s2>>s3>>s4; vector<string> day{"MON", "TUE", "WED", "THU", "FR

2021-07-24 19:22:54 74

原创 用LUA(和C++)刷PAT (Advanced Level) ——1060 Are They Equal

ioread = io.read('*a'):gmatch('%d+%p?%d*')local N = tonumber(ioread())local A = ioread() B = ioread()function getInfo(number) local digit = -1; local number_info = {} for i = 1, #number do local s = string.sub(number, i , i);

2021-07-24 18:46:20 81

原创 用LUA(和C++)刷PAT (Advanced Level) ——1059 Prime Factors

#include <iostream>#include <vector>#include <map>#include <cmath>using namespace std;int main(){ long int n; cin>>n; cout<<n<<"="; vector<int> primes; map<int, int> exponent

2021-07-24 18:25:57 66

原创 用LUA(和C++)刷PAT (Advanced Level) ——1058 A+B in Hogwarts

ioread = io.read('*a'):gmatch('%d+')function readNumber() return tonumber(ioread())endlocal G1 = readNumber() S1 = readNumber() K1 = readNumber()local G2 = readNumber() S2 = readNumber() K2 = readNumber()local G = G1 + G2 S = S1 + S2 K = K1 + K2

2021-07-24 16:55:18 127

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除