自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 1095 解码PAT准考证 (25分)

1095 解码PAT准考证 (25分)PAT 准考证号由 4 部分组成:第 1 位是级别,即 T 代表顶级;A 代表甲级;B 代表乙级;第 2~4 位是考场编号,范围从 101 到 999;第 5~10 位是考试日期,格式为年、月、日顺次各占 2 位;最后 11~13 位是考生编号,范围从 000 到 999。现给定一系列考生的准考证号和他们的成绩,请你按照要求输出各种统计信息。...

2020-04-20 16:04:45 394

原创 1093 字符串A+B (20分)

1093 字符串A+B (20分)给定两个字符串 A 和 B,本题要求你输出 A+B,即两个字符串的并集。要求先输出 A,再输出 B,但重复的字符必须被剔除。输入格式:输入在两行中分别给出 A 和 B,均为长度不超过 10610^6106​​ 的、由可见 ASCII 字符 (即码值为32~126)和空格组成的、由回车标识结束的非空字符串。输出格式:在一行中输出题面要求的 A 和 B 的...

2020-04-20 13:21:34 398

原创 1092 最好吃的月饼 (20分)

1092 最好吃的月饼 (20分)月饼是久负盛名的中国传统糕点之一,自唐朝以来,已经发展出几百品种。若想评比出一种“最好吃”的月饼,那势必在吃货界引发一场腥风血雨…… 在这里我们用数字说话,给出全国各地各种月饼的销量,要求你从中找出销量冠军,认定为最好吃的月饼。输入格式:输入首先给出两个正整数 N(≤1000)和 M(≤100),分别为月饼的种类数(于是默认月饼种类从 1 到 N 编号)...

2020-04-20 12:57:04 298

原创 1091 N-自守数 (15分)

1091 N-自守数 (15分)如果某个数 K 的平方乘以 N 以后,结果的末尾几位数等于 K,那么就称这个数为“N-自守数”。例如 3×922=2539292^2=25392922=25392,而 25392 的末尾两位正好是 92,所以 92 是一个 3-自守数。本题就请你编写程序判断一个给定的数字是否关于某个 N 是 N-自守数。输入格式:输入在第一行中给出正整数 M(≤20),随后...

2020-04-20 11:57:16 172

原创 1094 谷歌的招聘 (20分)

1094 谷歌的招聘 (20分)2004 年 7 月,谷歌在硅谷的 101 号公路边竖立了一块巨大的广告牌(如下图)用于招聘。内容超级简单,就是一个以 .com 结尾的网址,而前面的网址是一个 10 位素数,这个素数是自然常数 e 中最早出现的 10 位连续数字。能找出这个素数的人,就可以通过访问谷歌的这个网站进入招聘流程的下一步。自然常数 e 是一个著名的超越数,前面若干位写出来是这样的:...

2020-04-20 11:42:49 342

原创 wordcloud词云

一:Abstract使用Python制作词云,需要wordcloud,PIL,numpy,matplotlib库。如果要制作中文词云,还需要jieba库。本篇blog介绍wordcloud库和英文词云,中文词云的制作。代码在github上二: WordCloudwordcloud库把词云当作一个WordCloud对象,制作词云并保存都需要WordCloud对象。我个人觉得需要设置的属性为:f...

2020-01-16 15:29:20 1238 1

原创 python中self

Abstract学习Python中,对self有些疑惑,就查了些资料,列出我看到资料进行整理。selfpython 里所有的 object 都有三个属性, 标识(identity), 类型(type) 和值(value). 其中 identity 可以用 id 函数获得, CPython 里的实现是 object 的内存地址. 值就是 object 具体存放的数据, 而 type, obj...

2020-01-02 15:40:44 127

原创 Python中 is和 == 的区别

Abstract突然想到这个问题,就搜了搜,列出我看到的资料并进行整合is ==is 是引用相等(reference equality),用C语言来说,就是地址是否相同== 是值相等(value equality)is 表示的是对象标示符(object identity),我们在检查 a is b 的时候,其实相当于检查 id(a) == id(b)。而检查 a == b 的时候,实际...

2020-01-01 22:33:12 159

原创 井字棋 基于minimax算法的人工智能 in C++

import osdef print_board(board): print(board['TL'] + '|' + board['TM'] + '|' + board['TR']) print('-+-+-') print(board['ML'] + '|' + board['MM'] + '|' + board['MR']) print('-+-+-')...

2020-01-01 19:25:20 3237

原创 第一章:介绍操作系统

操作系统是什么操作系统是一个让你能运行程序,允许程序分享内存,

2019-06-19 23:51:53 171

原创 unsigned int无符号和int有符号的加法,乘法和取反

无符号和有符号在C语言里,整数的表示有有符号和无符号两种无符号有符号32位64位unsigned charchar11unsigned shortshort22unsigned intint44unsigned longlong48unsigned long longlong long88无符号是用原码表示,...

2019-04-19 15:06:28 2850

原创 C 指针和数组的区别

Abstract本人正在学习Stanford CS107,课程中让人不停的看汇编,写汇编,让我对数组和指针有个很深的认识。区别int *a 是一个指针,他是一个变量,可以取地址。int a[2]中的a是一个值,代表数组的地址。不能取地址。汇编在汇编里:这两个是这样的:数组:指针:指针和数组 with 函数Addition#include <stdio.h&g...

2019-03-01 11:39:46 612

原创 Stanford CS107 Assignment 5: Raw Memory

Abstract本人正在学习Stanford CS107。这门课很不错,我简单把这门课的信息说一下。keyvalue官网https://see.stanford.edu/Course/CS107课程名编程范式所需基础C,C++,数据结构与算法上课视频Bilibili搜索 https://www.bilibili.com/video/av97892...

2019-02-27 17:25:27 764

原创 Stanford CS107 Assignment 3: vector and hashset

Abstract本人正在学习Stanford CS107。这门课很不错,我简单把这门课的信息说一下。keyvalue官网https://see.stanford.edu/Course/CS107课程名编程范式所需基础C,C++,数据结构与算法上课视频Bilibili搜索 https://www.bilibili.com/video/av978920...

2019-02-22 14:44:30 319

原创 Stanford CS107 Assignment 2: Six Degrees of Kevin Bacon

Abstract本人正在学习Stanford CS107。这门课很不错,我简单把这门课的信息说一下。keyvalue官网https://see.stanford.edu/Course/CS107课程名编程范式所需基础C,C++上课视频Bilibili搜索 https://www.bilibili.com/video/av9789206(可能会失效...

2019-02-18 16:23:07 943 1

原创 Stanford CS107 Assignment 1: Random Sentence Generator(RSG)

Abstract本人正在学习Stanford CS107。这门课很不错,我简单把这门课的信息说一下。keyvalue官网https://see.stanford.edu/Course/CS107课程名编程范式所需基础C,C++上课视频Bilibili搜索 https://www.bilibili.com/video/av9789206(可能会失效...

2019-02-14 18:41:12 742

原创 菜鸟学nginx(2)代理服务器

Abstact本人菜鸟一枚:正在看官网文档学习Nginx。Nginx docs。这个系列作为学习笔记

2018-12-23 23:26:46 144

原创 菜鸟学nginx(0) 基础

2018-12-23 20:05:29 208

原创 菜鸟学nginx(1) 静态服务器

Abstact本人菜鸟一枚:正在看官网文档学习Nginx。Nginx docs。这个系列作为学习笔记

2018-12-23 19:19:52 160

原创 Lowest Common Ancestor in a Binary Search Tree

求BST两个结点的LCA因为是BST:所以可以使用BST的性质去找LCA。①左儿子的值小于父亲的值②右儿子的值大于父亲的值。所以对于结点1 Node1,结点2 Node2 的LCA:其LCA结点的值一定大于于Node1的值,小于Node2的值。所以寻找LCA就变得很容易。从root根结点开始遍历:遍历过程中:第一个结点的值大于Node1的值,小于Node2的值:就是Node1,Node2...

2018-12-18 18:46:24 126

原创 怎么判断两个链表是否有merge?如果有:在哪?

Abstact刷OJ时,遇到一个题:判断两个链表是否有merge?如果有?在哪?如下图:merge point在值为3的地方。在StackOverflow上一个回答特别棒:check if two linked lists merge现在记录下来。Algorithm算法很简单:同时遍历两个链表。设右边为current1(对应第一条链表),current2(对应第二条链表)。当curre...

2018-12-16 14:58:24 234

原创 PAT 1087 All Roads Lead to Rome (30 分)

1087 All Roads Lead to Rome (30 分)Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the route with the least cost while gaining the most happ...

2018-12-08 14:14:20 268

原创 PAT1072 Gas Station (30 分)

解析#include<iostream>#include<string>#include<vector>#include<algorithm>#include<unordered_map>using namespace std;const int INF = 0x3ffff

2018-12-08 12:41:53 238

原创 PAT 1018 Public Bike Management (30 分)

1018 Public Bike Management (30 分)There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and retu...

2018-12-08 10:12:41 279

原创 PAT 1030 Travel Plan (30 分)

1030 Travel Plan (30 分)A traveler’s map gives the distances between cities along the highways, together with the cost of each highway. Now you are supposed to write a program to help a traveler to de...

2018-12-07 21:14:26 91

原创 PAT1003 Emergency (25 分)

解析#include<cstdio>#include<vector>#include<algorithm>using namespace std;const int maxn = 1000;const int INF = 0x3fffffff;struct Node{ int v, w; Node(int _v, int _w) :v(_...

2018-12-07 19:18:13 135

原创 PAT1048 Find Coins (25 分)

解析#include<iostream>#include<string>#include<vector>#include<algorithm>#include<unordered_set>usin

2018-12-07 19:00:00 164

原创 PAT1050 String Subtraction (20 分)

解析是集合A中的元素去掉集合B的元素。#include<iostream>#include<cstdio>#include<string>#include<vector>#include<algorithm>#include<set>using namespace std;int main(){ str...

2018-12-07 17:48:07 196

原创 PAT1041 Be Unique (20 分)

1041 Be Unique (20 分)Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10410^4104]...

2018-12-07 17:45:25 105

原创 PAT1092 To Buy or Not to Buy (20 分)

1092 To 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 the...

2018-12-07 17:39:10 262

原创 PAT1084 Broken Keyboard (20 分)

1084 Broken 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 stri...

2018-12-07 17:36:31 183

原创 PAT 1146 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 suppo...

2018-12-07 10:19:50 180

原创 PAT test1 :1108,1109,1110,1111

模考马上要考PAT甲级了。所以后面的题目就当模考了。第一次模考成绩成绩用时792小时55分钟最后一道图题好复杂,而且我没学好图。所以最后一道题只拿了第一个测试点的9分。解析1108 Finding Average这是乙级的一道题。当时做的时候强行把实现了stod。当时记得花了很长时间。现在是模考,时间要紧,所以STL有stod,就用了STL的。其实只是判...

2018-12-06 17:27:06 261

原创 PAT 1062 Talent and Virtue (25 分)

1062 Talent and Virtue (25 分)About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people’s talent and virtue. According to his theory, a man being outst...

2018-12-05 14:08:27 127

原创 PAT 1107 Social Clusters (30 分)

解析#include<cstdio>#include<vector>#include<algorithm>using namespace std;const int maxn = 1010;int hobby[maxn]{0};bool isroot[maxn]{ false };int findFather(int x) { if (x =...

2018-12-04 21:23:41 350

原创 PAT 1076 Forwards on Weibo (30 分)

1076 Forwards on Weibo (30 分)Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed wit...

2018-12-04 15:20:55 170

原创 LeetCode 26. Remove Duplicates from Sorted Array

26. Remove Duplicates from Sorted Arrayclass Solution {public: int removeDuplicates(vector<int>& nums) { if(nums.size()==0) return 0; int unique = 1; ...

2018-12-04 10:19:25 102

原创 PAT 1034 Head of a Gang (30 分)

1034 Head of a Gang (30 分)One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a ...

2018-12-04 09:43:36 198

原创 LeetCode 917. Reverse Only Letterse

917. Reverse Only Letters/*using C++ STL*/class Solution {public: string reverseOnlyLetters(string S) { string Q; for(auto ch:S){ if(isalpha(ch)) Q...

2018-12-04 08:45:40 122

原创 Pillow学习笔记

Tutorial本文笔记来自于Pillow官网文档。仅供本人学习。Using the Image classReading and writing imagesCutting Pasting and merging imagesGeometrical transformsColor transformsImage enhancementImage sequencesPostsc...

2018-12-03 22:33:24 618

空空如也

空空如也

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

TA关注的人

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