- 博客(12)
- 收藏
- 关注
原创 设计模式GOF23
• 创建型模式: – 单例模式、工厂模式、抽象工厂模式、建造者模式、原型模式。 • 结构型模式: – 适配器模式、桥接模式、装饰模式、组合模式、外观模式、享元模式、代理模式。 • 行为型模式: – 模版方法模式、命令模式、迭代器模式、观察者模式、中介者模式、备忘录模式、解释器模式、状态模式、策略模式、职责链模式、访问者模式 单例模式 核心作用: – 保证一个类只有一个实例,并且提供一个访问该实例的全局访问点。 • 常见应用场景: – Windows的Task Manager(任务管理器)就是很典型的单例模式
2021-07-18 21:26:20 68
原创 pat甲级1012
思路 首先要构造合适的结构体,然后根据sort方法对stu数组进行排序,再进行比较 代码 #include<bits/stdc++.h> using namespace std; struct node{ string id; int c,m,e,a; int ms; string mc; }stu[2001]; bool cmp1(node x,node y){ return x.a>y.a; } bool cmp2(node x,node y)
2021-04-19 10:19:07 92
原创 PAT甲级1009 Product of Polynomials
题目 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 polynomial: K N 1 a N 1 N 2
2021-03-10 09:08:17 74
原创 PAT甲级1008
题目 1008 Elevator (20 分) The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one
2021-03-08 22:51:01 63
原创 PAT甲级1006
题目 1006 Sign In and Sign Out (25 分) 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 the door. Given the records of signing in’s and out’s, you are supposed to fin
2021-03-08 22:48:44 80
原创 PAT甲级007 Maximum Subsequence Sum
题目 Given a sequence of K integers { N1, N2, …, NK }. A continuous subsequence is defined to be { Ni, Ni+1, …, Nj } where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example
2021-03-07 00:36:44 109
原创 # PAT甲级1005 Spell It Right
:题目中文题目解题思路代码 题目 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 the door. Given the records of signing in’s and out’s, you are supposed to find the ones who have
2021-03-05 23:29:46 168
原创 PAT甲级1004 Counting Leaves
Counting Leaves 文章目录Counting Leaves题目中文意思解题思路代码 题目 A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Specification: Each input file contains one test case. Each case starts with a
2021-01-22 12:16:53 104
原创 PAT甲级-1003 Emergency
PAT甲级-1003 Emergency题目中文题目 题目 1003 Emergency (25分) As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the length
2021-01-18 21:33:51 190
原创 PAT甲级1002-A+B for Polynomials
文章目录题目一、解题思路二、代码总结 题目 一、解题思路 问题的关键点在于理解题意,每一行由非零多项式的个数k,还有k个 指数,系数构成。 由于题目中明确指数的范围是0-1000,所以想到用大小为1001的数组来存储系数,数组索引即为指数 签到题型,不知道为什么没有考虑到系数为零的项,还有指数为小数的情况。。。。。 二、代码 代码如下(示例): #include<stdio.h> #include<iostream> using namespace std; int main
2020-12-08 21:33:35 59
原创 #PAT1001甲级1001-A+B Format
PAT1001 文章目录PAT1001题目一、思路二、代码1.我的代码2.简书上的满分代码三、总结 题目 一、思路 对于这种格式化输出的题目。我第一反应是将数字转化成字符串,然后将字符串改造成符合要求的输出方法再进行输出。 具体处理方法是,先转换结果成字符串,再将结果去符号,方便每三个一组判别是否加,(最后一位不用加) 二、代码 1.我的代码 我的运行结果只有14分,淦!希望有大佬能点拨下错误,pat题库不能看测试类型有点难受。 代码如下(示例): #include<iostream>
2020-12-08 00:41:52 93
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人