自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 PAT甲级字符串处理1035 Password

这种题,要注意不能漏掉题目中给出的对特殊情况的特殊处理 。 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-01-23 17:19:47 138

原创 PAT甲级字符串处理1005 Spell It Right

Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English. Input Specification: Each input file contains one test case. Eac...

2019-01-23 15:51:11 116

原创 PAT甲级字符串处理1001 A+B Format

Calculate a+b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less than four digits). Input Specification: Each input ...

2019-01-23 15:13:22 123

原创 PAT甲级字符串处理1073 Scientific Notation

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[+-][0-9]+ which means that the inte...

2019-01-23 14:07:52 106

原创 PAT甲级字符串处理1061 Dating

1027 Colors in Mars 和这道题异曲同工 用数组简化对不同数值的讨论。 Sherlock Holmes received a note with some strange strings: Let's date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a m...

2019-01-22 20:09:41 157

原创 PAT甲级进制转换1027 Colors in Mars

学习本题中如何处理进制转换前后数字的对应关系。也算是一种哈希?  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 first 2 di...

2019-01-22 17:55:32 91

原创 PAT甲级进制转换1019 General Palindromic Number

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. All single digit numbers are palindromic numbers...

2019-01-22 17:55:26 92

原创 PAT甲级输出图案1031 Hello World for U

Given any string of N (≥5) characters, you are asked to form the characters into the shape of U. For example, helloworldcan be printed as: h d e l l r lowo That is, the characters must be print...

2019-01-22 17:55:18 90

原创 PAT甲级查找元素1036 Boys vs Girls

要考虑为零的情况!  初始化不能在可能取值范围内! scanf字符要用& 复制一时爽,挑错很绝望! This time you are asked to tell the difference between the lowest grade of all the male students and the highest grade of all t...

2019-01-22 17:55:12 113

原创 PAT甲级查找元素1011 World Cup Betting

昨天看了一本书,《你的灯亮着吗》,用一些小例子讲述各种情况下问题解决者面对问题做出的反应,很薄,不到两个小时就看完了, 会反复读。里面有一句话:当你以为你认为问题很好地解决了,其实并没有。正如下面这道题很简单,但显然有更简单的方法。 With the 2010 FIFA World Cup running, football fans the world over were becoming i...

2019-01-22 17:55:06 155

原创 PAT甲级查找元素1006 Sign In and Sign Out

时间格式的处理和判断逻辑的简化  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 i...

2019-01-22 17:54:55 101

原创 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 con...

2019-01-22 17:54:47 198

原创 PAT甲级无算法1046 Shortest Distance

现在一个很大的问题就是容易把问题复杂化,而正解往往又是在原来基础上加以简化得出的。一看就懂,确实最难的,这两天的做题都是如此。注意不要闭门造车。   The task is really simple: given N exits on a highway which forms a simple cycle, you are supposed to tell the shortest dis...

2019-01-22 17:54:40 74

原创 PAT甲级无算法1065 A+B and C (64bit)

大数运算的问题,需要考虑溢出的问题。判断依据为正+正得负为正溢出,负+负得正为正溢出。 另外,所有得问题都绕不开一个边界问题。上下边界用 数据类型界定,而中间则还需要考虑0得情况。 Given three integers A, B and C in [−2​63​​,2​63​​], you are supposed to tell whether A+B>C. Input Spec...

2019-01-22 17:54:35 107

原创 PAT甲级无算法1002 A+B for 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 informa...

2019-01-19 17:14:26 164

原创 PAT第一讲

首先要确定题目是单点测试还是多点测试,多数为单点测试。 本次内容涉及结构体排序(1004)、进制转换(1022)、人数统计(1038)括号内传送门 结构体排序---关键在熟练掌握sort方法  https://www.cnblogs.com/AlvinZH/p/6784862.html这里对sort有详细的介绍和实例。 需要注意的地方:这类题目中可能会要求二次排序,即学生成绩相等时,以姓名...

2019-01-19 17:13:46 106

原创 PAT甲级无算法1042 Shuffling Machine

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 emp...

2019-01-18 18:36:04 92

原创 STL容器总结

花了点时间总结了一下,直接看效果不好,要结合具体类型记忆 

2019-01-18 18:30:55 149

原创 STL优先队列

今天花了一个小时理顺了优先队列的基本操作 。 #include<bits/stdc++.h> using namespace std; struct fruit{ string name; int price; friend bool operator < (const fruit &f1,const fruit &f2){ // ...

2019-01-16 15:30:06 170

原创 PTA2018乙级1094 谷歌的招聘

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

2019-01-14 10:29:41 345

原创 PTA2018乙级1093 字符串A+B

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

2019-01-13 17:17:28 265

原创 PTA2018乙级1092 最好吃的月饼

若想评比出一种“最好吃”的月饼,那势必在吃货界引发一场腥风血雨…… 在这里我们用数字说话,给出全国各地各种月饼的销量,要求你从中找出销量冠军,认定为最好吃的月饼。 输入格式: 输入首先给出两个正整数 N(≤1000)和 M(≤100),分别为月饼的种类数(于是默认月饼种类从 1 到 N 编号)和参与统计的城市数量。 接下来 M 行,每行给出 N 个非负整数(均不超过 1 百万),其中第 i ...

2019-01-12 22:17:40 157

原创 PTA2018乙级1091N-自守数

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

2019-01-12 16:23:11 381

原创 2016冬天学习记录-2.10

我做出了一些重要的决定,第一,我打算省去我认为不重要的部分以使文章简洁明了;第二我必须时刻提醒自己对书中的意见保持思辨并且在完整明白作者思路之后再做记录而不贪功冒进囫囵吞枣,在此立个flag。 ---------代码十一、字符串连接的问题 两个字符串可以通过+连接,但是char在java中使用总有些别扭,定义一个字符串形如:char [] a = {'1','2','3'};还是char a[

2017-02-10 13:39:32 156

原创 2016冬天学习记录-2.09

---------代码三、计算溢出 刚刚研究了小数计算,现在看看大叔计算要注意的地方     定义一天中的微秒数和毫秒数如下: final long MICROS_PRE_DAY = 24*60*60*1000*1000; final long MILLIS_PRE_DAY = 24*60*60*1000; 则输出计算除法时会发现,System.out.println (MICRO

2017-02-09 20:36:38 201

原创 2016冬天学习记录-1.15

---------代码二、浮点型数字的处理 在计算(2-1.1)这样一个式子的时候,会发现,用System.out.println(2-1.1);计算出来的结果并不是0.9,而是0.89999999999,这是因为计算机在计算浮点型数字的时候需要首先将数据转化为二进制,但这种转化往往使计算结果失去精确性,所以我试着换一下思路,     开始我尝试这用printf控制输出格式:System.ou

2017-02-09 14:54:37 261

原创 2016冬天学习记录-1.14

-----------代码一、奇数性 这是一段判定奇数的代码          用import 在代码开头注明用到的类的全称(也可以说是它的位置),这样后面只需写出类的名字,系统运行时就会自动找到它,这里声明的Scanner类,用于数据输入。使用方法是先定义一个对象,再调用函数,如果再省略,用import java.util.*;这样的格式也可以,而且可以引用所有util包中的类,真是懒人福音

2017-01-15 19:17:03 251

空空如也

空空如也

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

TA关注的人

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