自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

nnnnnick的博客

奋力搏PAT的仔

  • 博客(109)
  • 收藏
  • 关注

原创 1002 写出这个数

读入一个正整数 n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含 1 个测试用例,即给出自然数 n 的值。这里保证 n 小于 10^100​​ 。输出格式:在一行内输出 n 的各位数字之和的每一位,拼音数字间有 1 空格,但一行中最后一个拼音数字后没有空格。输入样例:1234567890987654321123456789输出样例:yi san wu#include<iostream>using namespace std;int m

2021-01-29 20:28:55 137

原创 C语言逗号运算符的理解

逗号表达式注意两个基本知识:1. 逗号表达式的运算顺序是从左向右运算2. 逗号表达式的值取逗号中最右表达式的值现在看(a=3*5,a*4),a+5这个逗号表达式,首先对于(a=3*5,a*4)和a+5来说,按照从左向右运算先计算(a=3*5,a*4)(a=3*5,a*4)这个逗号表达式从左向右运算先计算a=3*5,这是个赋值语句,处理a=3*5=15再计算a*4,此时a=15,所以a*4=60,但是注意这个表达式并没有对a赋值,仅仅是一个乘法运算根据逗号表达式的值取逗号中最右表达式的值的

2020-11-30 20:05:52 2203

原创 java连接mysql数据库时的时区设置问题(time_zone)

转载:https://www.cnblogs.com/generalli2019/p/11512052.html

2020-06-05 21:33:28 661

原创 SpringMVC的执行流程

https://www.cnblogs.com/gxc6/p/9544563.html

2020-05-31 10:29:33 157

原创 1118 Birds in Forest(并查集)

Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belong to the same tree. You are supposed to help the scientists to count the maxi...

2019-09-07 14:01:20 109

原创 1141 PAT Ranking of Institutions(map+vector+tolower+结构体+sort)

After each PAT, the PAT Center will announce the ranking of institutions based on their students’ performances. Now you are asked to generate the ranklist.Input Specification:Each input file contain...

2019-09-06 15:15:02 100

原创 1137 Final Grading(vector+map)

For a student taking the online course “Data Structures” on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from...

2019-09-06 11:20:03 121

原创 1121 Damn Single(vector+set)

“Damn Single (单身狗)” is the Chinese nickname for someone who is being single. You are supposed to find those who are alone in a big party, so they can be taken care of.Input Specification:Each input ...

2019-09-05 17:11:33 96

原创 1112 Stucked Keyboard(map+set)

On a broken keyboard, some of the keys are always stucked. So when you type some sentences, the characters corresponding to those keys will appear repeatedly on screen for k times.Now given a resulti...

2019-09-05 11:27:51 100

原创 1124 Raffle for Weibo Followers(map)

John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo – that is, he would select winners from every N followers who forwarded his post, and give ...

2019-09-04 16:22:14 106

原创 1100 Mars Numbers(字符串+stoi)

People on Mars count their numbers with base 13:Zero on Earth is called “tret” on Mars.The numbers 1 to 12 on Earth is called “jan, feb, mar, apr, may, jun, jly, aug, sep, oct, nov, dec” on Mars, re...

2019-09-04 10:51:39 120

原创 1115 Counting Nodes in a BST(建BST+DFS)

A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than or equal to the node’s key.Th...

2019-09-03 17:04:59 96

原创 1090 Highest Price in Supply Chain(DFS)

A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the...

2019-09-03 11:38:59 109

原创 1089 Insert or Merge(InsertionSort+MergeSort,18/25)

According to Wikipedia:Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, ...

2019-09-02 21:28:09 181

原创 1086 Tree Traversals Again(数的遍历+栈+字符串数字混合输入)

An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac...

2019-09-02 13:50:19 109

原创 1084 Broken Keyboard(字符串+find)

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 string that you are supposed to ...

2019-08-31 17:16:06 82

原创 1071 Speech Patterns(map+cctype+auto)

People often have a preference among synonyms of the same word. For example, some may prefer “the police”, while others may prefer “the cops”. Analyzing such patterns can help to narrow down a speaker...

2019-08-31 14:41:47 77

原创 1030 Travel Plan(经典Dijkstra+DFS)

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 decide the shortest path b...

2019-08-30 18:12:39 219

原创 1094 The Largest Generation(DFS+height)

A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level belong to the same generation. Your task is to find the generation with the largest population.Input S...

2019-08-26 21:18:46 81

原创 1079 Total Sales of Supply Chain(DFS+height+v.resize(n))

A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in moving a product from supplier to customer.Starting from one root supplier, everyone on the...

2019-08-26 18:10:33 115

原创 1004 Counting Leaves(DFS+height)

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

2019-08-26 10:38:44 93

原创 1020 Tree Traversals(in+post->level order)

Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor...

2019-08-26 09:35:13 248

原创 1053 Path of Equal Weight(DFS+weight)

Given a non-empty tree with root R, and with weight W​i assigned to each tree node T​i. The weight of a path from R to L is defined to be the sum of the weights of all the nodes along the path from R ...

2019-08-26 09:14:44 149

原创 1052 Linked List Sorting(链表,结构体)

A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now give...

2019-08-16 21:01:33 115

原创 1032 Sharing(链表,结构体)

To store English words, one method is to use linked lists and store a word letter by letter. To save some space, we may let the words share the same sublist if they share the same suffix. For example,...

2019-08-16 19:24:43 92

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

2019-08-15 20:07:01 120

原创 1069 The Black Hole of Numbers(字符串的处理!最重要字符串题之一!)

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-decreasing order, a new number can be obtained by takin...

2019-08-14 20:11:14 91

原创 1065 A+B and C (64bit)(longlong取值范围问题)

Given three integers A, B and C in [−2 ^​63,2 ^​63], you are supposed to tell whether A+B>C.Input Specification:The first line of the input gives the positive number of test cases, T (≤10). Then ...

2019-08-14 18:32:48 130

原创 1061 Dating(cctype)

Sherlock Holmes received a note with some strange strings: Let’s date! 3485djDkxh4hhGE 2984akDfkkkkggEdsb s&hgsfdk d&Hyscvnm. It took him only a minute to figure out that those strange strings...

2019-08-13 19:47:34 129

原创 1050 String Subtraction(字符串+getline)

Given two strings S1 and S​2, S=S1−S2 is defined to be the remaining string after taking all the characters in S2 from S​1Your task is simply to calculate S1−S​2 for any given strings. However, it mi...

2019-08-13 13:41:34 133

原创 1042 Shuffling Machine(数组元素调换+字符数字拼接)

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

2019-08-12 21:11:59 70

原创 1035 Password(字符串+vector代替结构体)

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 distinguish 1 (one) from l (L ...

2019-08-11 20:45:02 73

原创 1031 Hello World for U(模拟题+memset)

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 rlowoThat is, the characters must be pr...

2019-08-11 11:59:53 95

原创 1015 Reversible Primes(素数判断+进制转换)

A reversible prime in any number system is a prime whose “reverse” in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a pr...

2019-08-05 23:04:56 78

原创 1005 Spell It Right(字符串+to_string)

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

2019-08-04 23:27:10 66

原创 1001 A+B Format(字符串+to_string)

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

2019-08-02 22:59:50 124

原创 1052 卖个萌(二维vector+字符串处理)

萌萌哒表情符号通常由“手”、“眼”、“口”三个主要部分组成。简单起见,我们假设一个表情符号是按下列格式输出的:左手[右手]现给出可选用的符号集合,请你按用户的要求输出表情。输入格式:输入首先在前三行顺序对应给出手、眼、口的可选符号集。每个符号括在一对方括号 []内。题目保证每个集合都至少有一个符号,并不超过 10 个符号;每个符号包含 1 到 4 个非空字符。之后一行给出一个正整数 K,...

2019-08-01 20:00:20 166

原创 1048 数字加密(字符串+append)

本题要求实现一种数字加密方法。首先固定一个加密用正整数 A,对任一正整数 B,将其每 1 位数字与 A 的对应位置上的数字进行以下运算:对奇数位,对应位的数字相加后对 13 取余——这里用 J 代表 10、Q 代表 11、K 代表 12;对偶数位,用 B 的数字减去 A 的数字,若结果为负数,则再加 10。这里令个位为第 1 位。输入格式:输入在一行中依次给出 A 和 B,均为不超过 100 ...

2019-07-31 23:21:32 296

原创 1039 到底买不买(字符串+数组;简单题)

小红想买些珠子做一串自己喜欢的珠串。卖珠子的摊主有很多串五颜六色的珠串,但是不肯把任何一串拆散了卖。于是小红要你帮忙判断一下,某串珠子里是否包含了全部自己想要的珠子?如果是,那么告诉她有多少多余的珠子;如果不是,那么告诉她缺了多少珠子。为方便起见,我们用[0-9]、[a-z]、[A-Z]范围内的字符来表示颜色。例如在图1中,第3串是小红想做的珠串;那么第1串可以买,因为包含了全部她想要的珠子,还...

2019-07-31 21:27:08 107

原创 1033 旧键盘打字(字符串和cin问题)

旧键盘上坏了几个键,于是在敲一段文字的时候,对应的字符就不会出现。现在给出应该输入的一段文字、以及坏掉的那些键,打出的结果文字会是怎样?输入格式:输入在 2 行中分别给出坏掉的那些键、以及应该输入的文字。其中对应英文字母的坏键以大写给出;每段文字是不超过 10​5​​ 个字符的串。可用的字符包括字母 [a-z, A-Z]、数字 0-9、以及下划线 _(代表空格)、,、.、-、+(代表上档...

2019-07-31 20:32:57 81

空空如也

空空如也

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

TA关注的人

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