- 博客(58)
- 资源 (1)
- 收藏
- 关注
原创 关于idea启动项目
git从git上clone代码下来,file->new->project from version control git在clone respository填入复制的urljre在file->project structure->project->project SDK 配置下好的版本mavenfile->setting->maven ->user settings file/local repository->Maven右侧有Reimpo
2022-05-19 17:17:13
487
原创 4.195555
枚举类https://blog.youkuaiyun.com/hellojoy/article/details/79883671序列化https://blog.youkuaiyun.com/u011215133/article/details/51177843数据库连接https://blog.youkuaiyun.com/weixin_42518008/article/details/113688550JSONObjecthttps://blog.youkuaiyun.com/weixin_43956958/article/details
2022-04-21 17:55:32
362
原创 考研失败,你该如何做选择
选择新的改变:**考研失败:**坚持了一年的考研失败,究其原因是:新的开始:记得有句名言,太阳底下没有新鲜事,人终究是要向前走的,那我我该如何选择呢?读了一本关于选择的书,教你如何做选择(以考研失败为例)拓宽选择空间一 考虑机会成本(相同时间和钱,你还能做啥)1.脱产二战2.在职二战3.工作4.调剂5.出国6.考公7.基层服务类考试(三支一扶等)8.考教师最后我还补充了一个帖子上的意见9.学校国际交流处,申请公费留学那么具体怎么得出选择的呢?主要有以下方式1.自己先
2022-02-28 19:38:50
279
原创 【无标题】
C语言练习题1.1,2,1,2,3,2,1,2,3,4,3,2,1,2,3,4,5,4,3,2,1,2,3,4,5,6,5,4,3,2,1void printn(int n){for(int i = 2; i < = n; i++)printf("%d ", i);for(int j = n - 1; j > 0; j--)printf("%d ", j);}int main(){int n;scanf("%d", n);printf("1 ");for(int
2022-02-19 16:48:49
466
原创 A1120
代码#include <iostream>#include <set>//insert插入 using namespace std;int getFriendNum(int a){ int sum = 0; while(a != 0){ sum += a%10; a /= 10; } return sum;}int main(){ set<int> s; int n,a; cin>>n; for(int i = 0; i
2021-03-04 16:29:24
185
1
原创 A1095
#include#include#include#include#includeusing namespace std;const int maxn = 10010;struct Car {char id[18];//车牌号int time;//时间都转化成秒 00:00:00记为0char status[4];}all[maxn], valid[maxn];int num = 0;//有效记录的条数map<string, int>parkTime;int timeT
2021-02-22 21:06:46
140
原创 A1080
#include#include#include#include#includeusing namespace std;struct Student{int GE,GI,sum;int r ,stuid;int cho[6];}stu[40010];struct School{int quota;//招生人数总额度int stuNum; //当前实际招生人数int id[40010];//招收的考生编号int lastAdmit; //记录最后一个招收的考生编号}sch[11
2021-02-21 11:13:51
106
原创 A1075
题目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 Specification:Each input file contains one test case. For each case, the first line con
2021-02-17 16:48:38
123
原创 PAT甲级——A1055 The World‘s Richest
题目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 this job, but concentrate only on the people in a certain range of ages. That is, given the net
2021-02-17 12:21:08
164
原创 A1028
题目1028 List Sorting (25point(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 case, the first line contains two integers N (≤105) an
2021-02-11 09:35:55
138
原创 A1021
题目A1012. The Best RankTo evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algebra), and E - English. At the mean time, we encou
2021-01-30 18:24:44
155
原创 B1015
题目宋代史学家司马光在《资治通鉴》中有一段著名的“德才论”:“是故才德全尽谓之圣人,才德兼亡谓之愚人,德胜才谓之君子,才胜德谓之小人。凡取人之术,苟不得圣人,君子而与之,与其得小人,不若得愚人。”现给出一批考生的德才分数,请根据司马光的理论给出录取排名。输入格式:输入第1行给出3个正整数,分别为:N(<=105),即考生总数;L(>=60),为录取最低分数线,即德分和才分均不低于L的考生才有资格被考虑录取;H(<100),为优先录取线——德分和才分均不低于此线的被定义为“才德全尽”
2021-01-29 18:29:30
173
原创 A1025
题目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 several places, and the ranklists will be merged immediately after the test. Now it is y
2021-01-29 17:38:14
143
原创 strcmp函数
strcmp函数是string compare(字符串比较)的缩写,用于比较两个字符串并根据比较结果返回整数。基本形式为strcmp(str1,str2),若str1=str2,则返回零;若str1<str2,则返回负数;若str1>str2,则返回正数 … **return strcmp(a.name,b.name)<0;**当a.name<b.name时,strcmp(a.name,b.name)为负数即将name字符串数组从小到大排列...
2021-01-28 18:57:11
639
原创 sort()函数
选择与直接插入排序void select(){ for(int i = 0; i < n; i++){ int k = i; for(int j = i; j < n ; j++){ if(A[k] > A[j]){//找最小 k = j;//留下标 } } int temp = A[i];//交换A[i]和A[j] A[] }}int A[max],n;void insert(){ for(int i = 1; i <
2021-01-28 18:49:00
495
原创 B1036
题目1036 跟奥巴马一起编程(15)(15 分)美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧!输入格式:输入在一行中给出正方形边长N(3<=N<=20)和组成正方形边的某种字符C,间隔一个空格。输出格式:输出由给定字符C画出的正方形。但是注意到行间距比列间距大,所以为了让结果看上去更像正方形,我们输出的
2021-01-27 18:06:42
98
原创 A1036
题目代码#include<cstdio>struct per{ char name[13]; char id[13]; int grade;}F,M,temp;//F为最高分女生信息,M为最低分男生信息void init(){ F.grade = -1; M.grade = 101; } int main(){ int n; init(); char gender; scanf("%d",&n); for(int i = 0; i < n;
2021-01-27 17:43:53
123
原创 A1006
题目【PAT】PAT A-1006 Sign In and Sign Out【简单模拟】昵称五个字 2019-04-08 15:07:23 438 收藏分类专栏: PAT 文章标签: PAT PAT甲级 算法题版权At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock
2021-01-27 16:00:41
127
原创 A1011
题目A1011 World Cup Betting (20 分)题目内容With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Similarly, football
2021-01-27 15:29:22
183
原创 B1028
题目1028 人口普查 (20分)某城镇进行人口普查,得到了全体居民的生日。现请你写个程序,找出镇上最年长和最年轻的人。这里确保每个输入的日期都是合法的,但不一定是合理的——假设已知镇上没有超过 200 岁的老人,而今天是 2014 年 9 月 6 日,所以超过 200 岁的生日和未出生的生日都是不合理的,应该被过滤掉。输入格式:输入在第一行给出正整数 N,取值在(0,105];随后 N 行,每行给出 1 个人的姓名(由不超过 5 个英文字母组成的字符串)、以及按 yyyy/mm/dd(即年
2021-01-26 19:00:19
142
原创 select sort
题目代码void selectSort(){ for(int i = 0; i < n; i++){//进行n趟操作 int k = i; for(int j = i; j <n; j++){//找出从i->n中最小的 if(A[j] < A[k]) k = j; } } int temp = A[i];//交换A[i]和A[j] A[i] = A[j]; A[j] = temp; }``...
2021-01-26 18:10:12
122
原创 B1004
题目B1004 成绩排名读入 n(>)名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。输入格式:每个测试输入包含 1 个测试用例,格式为第 1 行:正整数 n第 2 行:第 1 个学生的姓名 学号 成绩第 3 行:第 2 个学生的姓名 学号 成绩… … …第 n+1 行:第 n 个学生的姓名 学号 成绩其中姓名和学号均为不超过 10 个字符的字符串,成绩为 0 到 100 之间的一个整数,这里保证在一组测试用例中没有两个学生的成绩是相同的。输出格式:对每个
2021-01-26 18:00:25
149
原创 B1041
题目每个PAT考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需要换到考试座位就座。但有些考生迟到了,试机已经结束,他们只能拿着领到的试机座位号码求助于你,从后台查出他们的考试座位号码。输入格式:输入第一行给出一个正整数N(<=1000),随后N行,每行给出一个考生的信息:“准考证号 试机座位号 考试座位号”。其中准考证号由14位数字组成,座位从1到N编号。输入保证每个
2021-01-26 17:42:01
163
原创 A1009
题目A1009 Product of Polynomials (25 分)题目内容This time, you are supposed to find A×B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a poly
2021-01-26 15:52:38
195
1
原创 A1002
题目PAT-A1002. A+B for Polynomials (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThis time, you are supposed to find A+B where A and B are two polynomials.InputEach input file contains one test case. Each case occupies 2 lines,
2021-01-26 15:10:56
154
原创 A1046
题目1046 Shortest Distance (20分)The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest distance between any pair of exits.Input Specification:Each input file contains one test case. For eac
2021-01-19 16:44:14
159
原创 A1042
题目1042 Shuffling Machine (20 分)Shuffling is a procedure used to randomize a deck of playing cards. Because standard shuffling techniques are seen as weak, and in order to avoid “inside jobs” where employees collaborate with gamblers by performing inadequa
2021-01-19 15:18:54
121
原创 B1018. 锤子剪刀布
题目大家应该都会玩“锤子剪刀布”的游戏:两人同时给出手势,胜负规则如图所示:现给出两人的交锋记录,请统计双方的胜、平、负次数,并且给出双方分别出什么手势的胜算最大。输入格式:输入第1行给出正整数N(<=105),即双方交锋的次数。随后N行,每行给出一次交锋的信息,即甲、乙双方同时给出的的手势。C代表“锤子”、J代表“剪刀”、B代表“布”,第1个字母代表甲方,第2个代表乙方,中间有1个空格。输出格式:输出第1、2行分别给出甲、乙的胜、平、负次数,数字间以1个空格分隔。第3行给出两个字母,分别
2021-01-18 17:44:45
79
原创 算法4中视频1.3节栈(对象游离)loitering
对象游离(loitering)定义:即在栈的数组实现中有对象的引用,而我们并没有真正使用它,所以当减小N时,在数组中仍然有我们已经出栈的对象的指针。尽管我们知道我们不再使用它了,但是Java系统不知道解决:最好将去除元素对应的项设为null,这样就不会剩下...
2021-01-18 16:29:39
238
原创 B1012
题目代码#include<cstdio>int main(){ int count[] = {0}; int ans[] ={0}; int temp, n; scanf("%d",&n); while(n--){ scanf("%d",&temp); if(temp%5==0){//A1 if(temp%2==0){ count[0]++; ans[0] += temp;
2021-01-18 16:28:22
101
原创 B1008
题目代码#include<cstdio>int main(){ int a[3333]; int N,M,count=0; scanf("%d%d",&N,&M); M = M%N;//给M做修正 for(int i = 0; i < N; i++){ scanf("%d",&a[i]); } for(int i = N-M;i < N; i++){ printf("%d",a[i]);count++; if(count&
2021-01-16 16:51:54
192
1
原创 B1046
题目代码#include<cstdio>int main(){ int N,fa=0,fb=0; scanf("%d",&N); while(N--){ int ah,au,bh,bu; scanf("%d%d%d%d",&ah,&au,&bh,&bu); if(au == ah+bh && bu != ah+bh){ fb++; }else if(bu == ah+bh &&au !=
2021-01-16 16:30:51
98
原创 B1026
题目代码#include<cstdio>int main(){ int c1,c2; scanf("%d%d",&c1,&c2); int ans = c2-c1; if(ans%100 >= 50){ ans = ans/100+1; }else{ ans = ans/100; } printf("%02d:%02d:%02d",ans/3600,ans%3600/60,ans%60); return 0;}总结1.%02d表
2021-01-16 16:10:40
71
原创 B1016
题目代码#include<cstdio>int main(){ long long a,da,b,db,pa=0,pb=0; scanf("%lld%lld%lld%lld",&a,&da,&b,&db); while(a!=0){ if(a%10 == da){ pa = pa*10+da; a=a/10; } } while(b!=0){ if(b%10 == db){ pb = pb*10+db; b=b/1
2021-01-16 15:38:38
134
原创 B1011
题目代码#include<cstdio>int main(){ int T,i=1; //i代表第几个测试样例了 scanf("%d",&T); while(T--){ long long a,b,c; scanf("%lld%lld%lld",&a,&b,&c); if(a+b > c){ printf("Case #%d: true\n",i++); }else{ printf("Case #%d: false
2021-01-16 15:07:35
102
原创 B1032
题目代码#include<cstdio>const int maxn = 100010;//初始化数组10^5个index int school[maxn] = {0};//将其都赋值为零 int main(){ int n,score,schID=0; scanf("%d",&n); for(int i = 0;i < n; i++){ scanf("%d",&schID); scanf("%d",&score); school[sc
2021-01-12 17:30:16
123
原创 算法笔记B001
题目代码#include<cstdio> int main(){ int n ,i=0; scanf("%d",&n); while(n != 1){ if(n%2==0){ n = n/2; } else{ n = (3*n+1)/2; //要将其赋值给n; } i++; } return i;}结果
2021-01-12 16:55:11
116
原创 2020-10-05
讨论1.6 算法3的空间复杂度是多少?老师参与具体来说,这个问题分两部分:由于递归而产生的空间复杂度是多少?算法的整体空间复杂度一共是多少?分而治之的算法时间复杂度T(N)=2T(N/2)+O(N)=2(2T(N/(2^2))+cN/2)+cN=2^kO(1)+ckN其中N/(2^k)=1k=log2(N)1.空间复杂度1.整体假如 n 个数据,中间一分为二,求左边空间要 n/2,右边也是一样。跨越分界线的部分需要扫描一遍左边和右边,加起来是 n所以总共是 S(n) = 2
2020-10-05 21:18:29
344
原创 二分法分析
时间复杂度:最好情况下,一击命中,为常数级时间C;最坏情况下,一直二分到剩一个元素,则时间复杂度为log2N空间复杂度:最好情况下,一击命中,不用后续递归,即不用占用调用函数时函数栈的空间,此时空间复杂度为 C 最坏情况下,一直递归二分,需要二分log2N次,即调用函数log2N次,此时空间复杂度为C * log2N时间复杂度计算(看运行次数最多的那条语句被运行了多少次)O(2n)O(2^n)O(2n),表示一个算法的性能会随着输入数据的每次增加而增大两倍,典..
2020-10-05 10:16:26
1145
原创 讨论1.3 再试一个多项式
#include<stdio.h>#include<math.h>#include<time.h>#声明clock_t start,stop;double duration;double f1(double x);double f2(double x);int main(){ start = clock(); for(int i = 0;i<10000;i++)#时间过短,加长好比较 f1(1.1); stop = clock(); .
2020-10-05 09:34:04
204
中对象数组的应用与实验
2019-07-27
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅