- 博客(66)
- 收藏
- 关注
原创 ftp服务器项目
ftp_file_server服务器代码地址1. 简介 实现了一个简单的ftp文件服务器,总共支持注册、登录、上传、下载、删除、新建文件夹、切换目录、显示当前路径、显示文件等功能2. 具体实现2.1 服务端 主要负责处理客户端发来的指令,对于复杂指令即比较耗时的指令(get, put)用子线程进行处理,其余指令用主线程处理2.1.1 线程池 主要分为线程池的创建和启动// 定义单个任务typedef struct node { int sockFd; s
2021-02-23 00:36:16 493
原创 Ubuntu添加gcc头文件搜索路径
对个人用户生效sudo vim ~/.bashrc在该文件末尾添加#gccC_INCLUDE_PATH=$C_INCLUDE_PATH:your_pathexport C_INCLUDE_PATH#g++CPLUS_INCLUDE_PATH=$CPLUS_INCLUDE_PATH:your_pathexport CPLUS_INCLUDE_PATH最后,重启终端即可生效可用以下命令查看搜索路径echo | gcc -x c -v -E -echo | gcc -x c++ -v
2021-01-01 16:54:37 1818
原创 C语言操作数据库(一)
Ubuntu18.04 C语言操作Mysql准备环境- Ubuntu18.04- Mysql5.7.32- gcc安装Ubuntu与gcc的安装不赘述,Mysql安装教程如下:sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.10-1_all.debsudo dpkg -i mysql-apt-config_0.8.10-1_all.debsudo apt-get updatesudo apt-get install
2020-12-30 13:09:08 2570 1
原创 PAT甲级1049(数1)
1049 Counting Ones (30 point(s)) The task is simple: given any positive integer N, you are supposed to count the total number of 1’s in the decimal form of the integers from 1 to N. For example, giv...
2019-11-27 19:04:38 227
原创 PAT甲级1120(友好数)
1120 Friend Numbers (20 point(s)) Two integers are called “friend numbers” if they share the same sum of their digits, and the sum is their “friend ID”. For example, 123 and 51 are friend numbers si...
2019-11-27 10:10:27 162
原创 PAT甲级1104(子列之和)
1104 Sum of Number Segments (20 point(s)) Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we have ...
2019-11-26 14:10:55 474 2
原创 PAT甲级1069(数字黑洞)
1069 The Black Hole of Numbers (20 point(s)) For any 4-digit integer except the ones with all the digits being the same, if we sort the digits in non-increasing order first, and then in non-decreasi...
2019-11-25 16:39:06 200
原创 PAT甲级1101(快速排序)
1101 Quick Sort (25 point(s)) There is a classical process named partition in the famous quick sort algorithm. In this process we typically choose one element as the pivot. Then the elements less th...
2019-11-25 14:32:40 286
原创 PAT甲级1093(PAT个数)
1093 Count PAT’s (25 point(s)) The string APPAPT contains two PAT’s as substrings. The first one is formed by the 2nd, the 4th, and the 6th characters, and the second one is formed by the 3rd, the 4...
2019-11-25 10:16:43 168
原创 PAT甲级1029(中位数)
1029 Median (25 point(s)) Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1 = { 11, 12, 13, 14 } is 12, and the median of S...
2019-11-24 19:31:54 215
原创 PAT甲级1089(插入排序还是归并排序)
1089 Insert or Merge (25 point(s))According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort remo...
2019-11-24 13:53:56 284
原创 PAT甲级1044(在火星购物)
1044 Shopping in Mars (25 point(s)) Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making the payment,...
2019-11-24 11:23:20 233
原创 PAT甲级1010(进制)
1010 Radix (25 point(s)) Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is yes, if 6 is a decimal number and 110 is a binary number.Now for...
2019-11-23 15:07:26 492
原创 PAT甲级1085(完美数列)
1085 Perfect Sequence (25 point(s)) Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the maximum and min...
2019-11-23 14:02:21 378
原创 PAT甲级1038(恢复最小数字)
1038 Recover the Smallest Number (30 point(s)) Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we ca...
2019-11-22 13:42:06 292
原创 PAT甲级1067(用swap(0,*)排序)
1067 Sort with Swap(0, i) (25 point(s)) Given any permutation of the numbers {0, 1, 2,…, N−1}, it is easy to sort them in increasing order. But what if Swap(0, *) is the ONLY operation that is allow...
2019-11-22 12:51:34 195
原创 PAT甲级1037(有魔力的优惠券)
1037 Magic Coupon (25 point(s)) The magic shop in Mars is offering some magic coupons. Each coupon has an integer N printed on it, meaning that when you use this coupon with a product, you may get N...
2019-11-21 13:16:03 152
原创 PAT甲级1033(加还是不加)
1033 To Fill or Not to Fill (25 point(s)) With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas station...
2019-11-20 16:33:50 265
原创 PAT甲级1070(月饼)
1070 Mooncake (25 point(s))题目原文 Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes acco...
2019-11-19 14:22:42 158
原创 PAT甲级1048(找硬币)
1048 Find Coins (25 point(s)) 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 kind...
2019-11-19 13:41:01 154
原创 PAT甲级1050(字符串减法)
1050 String Subtraction (20 point(s)) Given two strings S1 and S2, S=S1−S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate...
2019-11-18 14:56:15 196
原创 PAT甲级1041(独一无二的数字)
1041 Be Unique (20 point(s)) 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,10...
2019-11-18 14:00:22 327
原创 PAT甲级1092(买还是不买)
1092 To Buy or Not to Buy (20 point(s)) 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. Ho...
2019-11-18 13:28:12 113
原创 PAT甲级1084(坏键盘打字)
1084 Broken Keyboard (20 point(s)) 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 g...
2019-11-18 13:19:43 156
原创 PAT甲级1095(校园停车)
1095 Cars on Campus (30 point(s)) Zhejiang University has 8 campuses and a lot of gates. From each gate we can collect the in/out times and the plate numbers of the cars crossing the gate. Now with ...
2019-11-18 10:41:36 316
原创 PAT甲级1080(研究生录取)
1080 Graduate Admission (30 point(s)) It is said that in 2011, there are about 100 graduate schools ready to proceed over 40,000 applications in Zhejiang Province. It would help a lot if you could w...
2019-11-16 11:47:11 173
原创 PAT甲级1083(成绩列表)
1083 List Grades (25 point(s)) Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those stu...
2019-11-15 14:20:49 209
原创 PAT甲级1075(PAT 评判)
1075 PAT Judge (25 point(s)) The ranklist of PAT is generated from the status list, which shows the scores of the submissions. This time you are supposed to generate the ranklist for PAT.Input Spec...
2019-11-15 13:42:56 235
原创 PAT甲级1055(找出给定区间的前M名富人)
1055 The World’s Richest (25 point(s)) Forbes magazine publishes every year its list of billionaires based on the annual ranking of the world’s wealthiest people. Now you are supposed to simulate th...
2019-11-14 15:53:44 172
原创 PAT甲级1028(列表排序)
1028 List Sorting (25 point(s)) Excel can sort records according to any column. Now you are supposed to imitate this function.Input Specification: Each input file contains one test case. For each...
2019-11-14 15:20:14 168
原创 PAT甲级1025(PAT 排名)
1025 PAT Ranking (25 point(s)) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in se...
2019-11-13 13:10:29 365 1
原创 PAT甲级1082
1082 Read Number in Chinese (25 point(s)) Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way. Output Fu first if it is negative. For example, -12...
2019-11-12 21:46:09 218
原创 PAT甲级1035
1035 Password (20 point(s)) To prepare for PAT, the judge sometimes has to generate random passwords for the users. The problem is that there are always some confusing passwords since it is hard to ...
2019-11-11 14:15:09 326
原创 PAT甲级1073
1073 Scientific Notation (20 point(s)) 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-...
2019-11-11 11:16:27 176
原创 PAT甲级1058
1058 A+B in Hogwarts (20 point(s)) If you are a fan of Harry Potter, you would know the world of magic has its own currency system – as Hagrid explained it to Harry, “Seventeen silver Sickles to a G...
2019-11-10 17:09:32 235
原创 PAT甲级1027
1027 Colors in Mars (20 point(s))题目原文 People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the fir...
2019-11-10 16:50:20 145 1
原创 PAT甲级1019
1019 General Palindromic Number (20 point(s)) A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. ...
2019-11-10 16:08:30 176
原创 PAT甲级1031
1031 Hello World for U (20 point(s))题目原文 Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworld can be printed as:h de ll rl...
2019-11-10 15:13:14 119
原创 PAT甲级1036
1036 Boys vs Girls (25 point(s)) This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all the female students.Input Specificatio...
2019-11-09 19:24:50 122
原创 PAT甲级1066
1066 Root of AVL Tree (25 point(s))题目原文 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 t...
2019-11-08 21:30:41 206
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人