- 博客(166)
- 资源 (1)
- 收藏
- 关注
原创 C语言难点三:结合计组的整数加减运算
示例程序#include<stdio.h>int main(){ unsigned char a=0; int b=1; do{ b++; a--; }while(a!=0); printf("%d\n",b); return 0;该程序运行结果为257结合计组中的减法相当于加上补码就可以很好的理解,为了直观表示,利用c++中的bitset函数输出a的二进制以及a的十进制#include<stdio.h>#include<bits/stdc
2020-07-24 20:08:30
1095
原创 C语言难点一:printf多个变量输出计算次序中的自增与自减
devc++下#include<stdio.h>int main(){ //关于printf中变量的输出次序以及自增自减 int i=1; printf("%d,%d,%d,%d\n",i++,++i,i++,++i); //4,5,2,5 printf("%d\n",i); //5 i=1; printf("%d,%d,%d,%d\n",++i,++i,++i,++i); //5,5,5,5 printf("%d\n",i); //5 i=1; print
2020-07-24 19:27:02
2475
7
原创 C语言难点二:结构体指针引用char *变量中*++p->pk与*p++->pk解析
devc++下运行#include<stdio.h>struct node{ int len; char *pk;}x={2,"right"},*p=&x; int main(){ //结构体指针用->,结构体变量用. //以下为两种正确的表达 printf("%d,%s\n",p->len,p->pk); //2,right printf("%d,%s\n",x.len,x.pk); //2,right //printf("
2020-07-24 19:25:11
3977
5
原创 Scrapy豆瓣爬虫 爬取用户以及用户关注关系
文章目录明确任务1.新建mysql数据库以及数据表1.1 创建数据库1.2 创建用户信息表users1.3 创建用户关注表user_follows笔记一: mysql中utf8与utf8mb4字符编码笔记二:mysql中的排序规则2.PyCharm搭建Scrapy爬虫项目2.1 创建一个Scrapy工程笔记三:scrapy基本命令创建项目运行项目开始爬虫控制台暂停和终止爬虫笔记四:scrapy工程...
2020-07-12 15:10:26
3201
1
原创 MySQL基础知识一:数据表的创建、维护、删除
文章目录1.创建数据表1.1 数据类型1)字符类型2)时间和日期类型3)数值数据类型4)enum数据类型1.2 创建数据表sql命令2.维护数据表2.1 增加、修改和删除字段2.2 增加、修改和删除约束3.删除数据表3.1 仅删除数据3.2 删除结构和数据1.创建数据表1.1 数据类型1)字符类型区别charvarchar存储实际长度声明时定义的长度实际值的长度+...
2020-01-10 18:02:44
786
原创 2019年3月2号 第一次考PAT甲级总结
总分94,其实是运气比较好。还好这次第一题不是很坑,之前9月份和12月份第一题暴力求解其实都不是很会。记录一下自己的心路历程。13:32:30 第一次提交第一题 15分好像是有两个测试点错误,然后没管直接做下一题13:43:55 第一次提交第二题 20分此时已经35分,发现时间还早,打算把这题再看看找BUG13:53:39 成功AC第二题 25分然后没管第一题就去做第三...
2019-03-23 18:46:18
2155
1
原创 甲级PAT 2019年3月 Structure of a Binary Tree (30 分)
7-4Structure of a Binary Tree(30分)Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, a binary tree can be uniquely det...
2019-03-23 18:45:20
555
原创 甲级PAT 2019年3月 Anniversary (25 分)
7-2Anniversary(25分)Zhejiang University is about to celebrate her 122th anniversary in 2019. To prepare for the celebration, the alumni association (校友会) has gathered the ID's of all her alumni. N...
2019-03-23 18:43:41
549
原创 甲级PAT 2019年3月 Sexy Primes (20 分)
7-1Sexy Primes(20分)Sexy primes are pairs of primes of the form (p,p+6), so-named since "sex" is the Latin word for "six". (Quoted fromhttp://mathworld.wolfram.com/SexyPrimes.html)Now given an...
2019-03-23 18:42:04
1359
原创 甲级PAT 1084 Broken Keyboard (20 分)(vector)
1084Broken Keyboard(20 分)On a broken keyboard, some of the keys are worn out. So when you type some sentences, the characters corresponding to those keys will not appear on screen.Now given a st...
2019-03-23 18:11:45
152
原创 甲级PAT 1060 Are They Equal (25 分)(科学表示法)
1060Are They Equal(25 分)If a machine can save only 3 significant digits, the float numbers 12300 and 12358.9 are considered equal since they are both saved as0.123×105with simple chopping. No...
2019-03-23 18:11:39
159
原创 甲级PAT 1073 Scientific Notation (20 分)(科学计数法)
1073Scientific Notation(20 分)Scientific notation is the way that scientists easily handle very large numbers or very small numbers. The notation matches the regular expression [+-][1-9].[0-9]+E[+-...
2019-03-23 18:11:31
185
原创 甲级PAT 1068 Find More Coins (30 分)(动态规划)
1068Find More Coins(30 分)Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds o...
2019-03-23 18:11:16
188
原创 蓝桥杯2016第7届C++B组省赛 四平方和
题目四平方和定理,又称为拉格朗日定理:每个正整数都可以表示为至多4个正整数的平方和。如果把0包括进去,就正好可以表示为4个数的平方和。比如:5 = 0^2 + 0^2 + 1^2 + 2^27 = 1^2 + 1^2 + 1^2 + 2^2(^符号表示乘方的意思)对于一个给定的正整数,可能存在多种平方和的表示法。要求你对4个数排序:0 <= a <= b &l...
2019-03-23 17:59:34
258
原创 甲级PAT 1074 Reversing Linked List (25 分)(链表)
1074Reversing Linked List(25 分)Given a constantKand a singly linked listL, you are supposed to reverse the links of everyKelements onL. For example, givenLbeing 1→2→3→4→5→6, ifK=3, then y...
2019-03-01 23:08:52
202
原创 甲级PAT 1052 Linked List Sorting (25 分)(链表)
1052Linked List Sorting(25 分)A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integerkeyand aNextpointe...
2019-03-01 23:08:01
153
原创 甲级PAT 1032 Sharing (25 分)(链表)
1032Sharing(25 分)To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same...
2019-03-01 23:07:02
193
原创 甲级PAT 1092 To Buy or Not to Buy (20 分)(散列)
1092To Buy or Not to Buy(20 分)Eva would like to make a string of beads with her favorite colors so she went to a small shop to buy some beads. There were many colorful strings of beads. However th...
2019-03-01 23:06:00
164
原创 甲级PAT 1071 Speech Patterns (25 分)(map)
1071Speech Patterns(25 分)People often have a preference among synonyms of the same word. For example, some may prefer "the police", while others may prefer "the cops". Analyzing such patterns can ...
2019-03-01 23:04:48
258
原创 甲级PAT 1063 Set Similarity (25 分)(集合,set)
1063Set Similarity(25 分)Given two sets of integers, the similarity of the sets is defined to beNc/Nt×100%, whereNcis the number of distinct common numbers shared by the two sets, andN...
2019-03-01 23:03:28
154
原创 甲级PAT 1056 Mice and Rice (25 分)(模拟比赛)
1056Mice and Rice(25 分)Mice and Riceis the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each m...
2019-03-01 23:01:58
180
原创 甲级PAT 1138 Postorder Traversal (25 分)(先序中序转后序)
1138Postorder Traversal(25 分)Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to output the first num...
2019-03-01 22:54:59
223
原创 甲级PAT 1140 Look-and-say Sequence (20 分)(逻辑题)
1140Look-and-say Sequence(20 分)Look-and-say sequence is a sequence of integers as the following:D, D1, D111, D113, D11231, D112213111, ...whereDis in [0, 9] except 1. The (n+1)st number is...
2019-03-01 22:52:51
216
原创 甲级PAT 1142 Maximal Clique (25 分)(bfs)
1142Maximal Clique(25 分)Acliqueis a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent. Amaximal cliqueis a clique that cannot be extend...
2019-03-01 22:51:30
177
原创 甲级PAT 1052 Linked List Sorting (25 分)(链表)
1052Linked List Sorting(25 分)A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integerkeyand aNextpointe...
2019-02-28 16:25:00
142
原创 甲级PAT 1032 Sharing (25 分)(链表)
1032Sharing(25 分)To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same...
2019-02-28 16:01:57
198
原创 甲级PAT 1144 The Missing Number (20 分)
1144 The Missing Number (20 分)Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list.Input Specification:Each input file contains one test case. F...
2019-02-27 17:19:03
112
原创 甲级PAT 1152 Google Recruitment (20 分)(暴力求解)
1152 Google Recruitment (20 分)In July 2004, Google posted on a giant billboard along Highway 101 in Silicon Valley (shown in the picture below) for recruitment. The content is super-simple, a URL co...
2019-02-27 17:03:17
310
原创 Dev c++下 [Error] ‘stoi’ was not declared in this scope
使用了万能头文件#include<bits/stdc++.h>工具-》编译器选项-》代码生成/优化-》代码生成-》将语言标准调成GUN C++11就可以成功使用stoi函数了
2019-02-27 17:00:07
4063
2
原创 甲级PAT 1145 Hashing - Average Search Time (25 分)(hash,二次方探测)
1145 Hashing - Average Search Time (25 分)The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of integer key...
2019-02-27 16:31:41
366
原创 甲级PAT 1148 Werewolf - Simple Version (20 分)(暴力求解)
1148 Werewolf - Simple Version (20 分)Werewolf(狼人杀) is a game in which the players are partitioned into two parties: the werewolves and the human beings. Suppose that in a game,player #1 said: "Pla...
2019-02-27 16:16:49
206
原创 甲级PAT 1149 Dangerous Goods Packaging (25 分)(map,vector)
1149 Dangerous Goods Packaging (25 分)When shipping goods with containers, we have to be careful not to pack some incompatible goods into the same container, or we might get ourselves in serious trou...
2019-02-27 16:06:52
149
原创 甲级PAT 1147 Heaps (30 分)(堆排序)
1147 Heaps (30 分)In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either greater ...
2019-02-27 15:58:54
203
原创 甲级 PAT1146 Topological Order (25 分)(拓扑排序)
1146 Topological Order (25 分)This is a problem given in the Graduate Entrance Exam in 2018: Which of the following is NOT a topological order obtained from the given directed graph? Now you are supp...
2019-02-27 15:49:42
259
原创 甲级PAT 1123 Is It a Complete AVL Tree (30 分)(AVL,CBT)
1123 Is It a Complete AVL Tree (30 分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they ...
2019-02-27 15:45:16
146
原创 甲级PAT 1066 Root of AVL Tree (25 分)(AVL)
1066 Root of AVL Tree (25 分)An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by...
2019-02-24 14:56:27
205
原创 甲级PAT 1155 Heap Paths (30 分)(dfs,堆排序)
1155 Heap Paths (30 分)In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the value) of P is either gre...
2019-02-24 11:31:03
163
原创 甲级PAT 1151 LCA in a Binary Tree (30 分)(LCA)
1151 LCA in a Binary Tree (30 分)The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.Given any two nodes in a binary tree, you a...
2019-02-24 10:40:46
162
原创 甲级PAT 1051 Pop Sequence (25 分)(stack)
1051 Pop Sequence (25 分)Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a ...
2019-02-23 22:41:23
161
原创 甲级PAT 1143 Lowest Common Ancestor (30 分)(LCA)
1143 Lowest Common Ancestor (30 分)The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is recursively...
2019-02-23 18:45:24
213
飞机大战源码(JAVA课设)
2018-12-01
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人