![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Pat
Twenty__Seven
年轻嘛~就应该站在风口浪尖~
展开
-
Pat B1016
package com.cn.kh;import java.util.Scanner;/** * <p>Title:B0132else * <p>Description:<p> * @author Twenty-seven * @date 2018年6月3日 上午10:16:07 */public class B0132else { pu...原创 2018-06-03 14:18:14 · 152 阅读 · 0 评论 -
A1027 Colors in Mars (20)
1027 Colors in Mars (20)(20 分)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 digi...原创 2018-08-09 22:40:51 · 111 阅读 · 0 评论 -
B1031 查验身份证(15)(15 分)
1031 查验身份证(15)(15 分)一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下:首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};然后将计算的和对11取模得到值Z;最后按照以下关系对应Z值与校验码M的值:Z:0 1 2 3 4 5 6 7 8 9 10\ M:1 0 X...原创 2018-08-05 22:30:04 · 598 阅读 · 0 评论 -
进制问题的处理方法
1.对一个A进制的数字,如果要转换为B进制,分为两步 (1)将A进制数先转化为10进制 从右向左,逐个把每一位取出,乘对应的权值,然后累加即可得到十进制的数值. int a,e=1,res=0; scanf("%d",&a);//输入一个2进制 //2-10 while(a!=...原创 2018-08-14 17:51:12 · 378 阅读 · 0 评论 -
A1058 A+B in Hogwarts (20)
1058 A+B in Hogwarts (20)(20 分)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 Gall...原创 2018-08-11 21:21:12 · 111 阅读 · 0 评论 -
A1019General Palindromic Number (20)
1019 General Palindromic Number (20)(20 分)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 ...原创 2018-08-08 22:10:43 · 135 阅读 · 0 评论 -
A1025PAT Ranking (25)
1025 PAT Ranking (25)(25 分)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 severa...原创 2018-08-18 14:52:20 · 89 阅读 · 0 评论 -
排序问题,RANK的处理,比较函数,sort()
排序问题C++中提供sort()函数,默认是从小到大排序 目前编写的这个要求: 1.当分数不同,按照成绩从大到小排序 2.当成绩相同,则按照准考证号从大到小排序1.比较函数的编写bool comp(Student a,Student b){ if(a.score!=b.score){...原创 2018-08-18 14:47:06 · 1122 阅读 · 0 评论 -
PAT B1086
1086 就不告诉你 (15 分)做作业的时候,邻座的小盆友问你:“五乘以七等于多少?”你应该不失礼貌地围笑着告诉他:“五十三。”本题就要求你,对任何一对给定的正整数,倒着输出它们的乘积。输入格式:输入在第一行给出两个不超过 1000 的正整数 A 和 B,其间以空格分隔。输出格式:在一行中倒着输出 A 和 B 的乘积。输入样例:5 7输出样例:53思...原创 2018-10-11 19:58:12 · 269 阅读 · 0 评论 -
A1046 Shortest Distance(20)
1046 Shortest Distance (20)(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.任务很简单,给N条围...原创 2018-08-05 14:05:24 · 116 阅读 · 0 评论 -
B1037 在霍格沃茨找零钱(20)
1037 在霍格沃茨找零钱(20)(20 分)如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱P和他实付的钱A,你的任务是写一个程序来计算他应该被找的零钱。输入格式:输入在1行中分别给出P和A,格式为“Galleon.Si...原创 2018-08-05 13:53:07 · 169 阅读 · 0 评论 -
B1021个位数统计(15)
1021 个位数统计 (15)(15 分)给定一个k位整数N = d~k-1~*10^k-1^ + ... + d~1~*10^1^ + d~0~ (0<=d~i~<=9, i=0,...,k-1, d~k-1~>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定N = 100311,则有2个0,3个1,和1个3。输入格式:每个输入包含1个测试用例,即一个不...原创 2018-08-05 12:16:32 · 307 阅读 · 1 评论 -
PAT-1036输出正方形
1036 跟奥巴马一起编程(15)(15 分)美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧!输入格式:输入在一行中给出正方形边长N(3<=N<=20)和组成正方形边的某种字符C,间隔一个空格。输出格式:输出...原创 2018-07-12 10:07:20 · 457 阅读 · 0 评论 -
PAT-1032挖掘机技术哪家强?
1032 挖掘机技术哪家强(20)(20 分)为了用事实说明挖掘机技术到底哪家强,PAT组织了一场挖掘机技能大赛。现请你根据比赛结果统计出技术最强的那个学校。输入格式:输入在第1行给出不超过10^5^的正整数N,即参赛人数。随后N行,每行给出一位参赛者的信息和成绩,包括其所代表的学校的编号(从1开始连续编号)、及其比赛成绩(百分制),中间以空格分隔。输出格式:在一行中给出总得分最高的学校的编号、及...原创 2018-07-12 10:25:17 · 2305 阅读 · 0 评论 -
冒泡排序
冒泡排序算法的运作如下:(从后往前)比较相邻的元素。如果第一个比第二个大,就交换他们两个。对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对。在这一点,最后的元素应该会是最大的数。针对所有的元素重复以上的步骤,除了最后一个。持续每次对越来越少的元素重复上面的步骤,直到没有任何一对数字需要比较。 #include<stdio.h>int main(){ int a[5]={5...原创 2018-07-12 10:46:40 · 109 阅读 · 0 评论 -
PAT-1002写出这个数
1002 写出这个数 (20)(20 分)读入一个自然数n,计算其各位数字之和,用汉语拼音写出和的每一位数字。输入格式:每个测试输入包含1个测试用例,即给出自然数n的值。这里保证n小于10^100^。输出格式:在一行内输出n的各位数字之和的每一位,拼音数字间有1 空格,但一行中最后一个拼音数字后没有空格。输入样例:1234567890987654321123456789输出样例:yi san w...原创 2018-07-12 15:22:58 · 157 阅读 · 0 评论 -
PAT A1002 A+B for Polynomials(25)
1002 A+B for Polynomials (25)(25 分)This 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, and each lin...原创 2018-07-24 11:11:27 · 102 阅读 · 0 评论 -
PAT A1042 Shuffing Machine(20)
1042 Shuffling Machine (20)(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" whe...原创 2018-07-24 12:45:17 · 206 阅读 · 0 评论 -
PAT B1004
1004 成绩排名 (20)(20 分)读入n名学生的姓名、学号、成绩,分别输出成绩最高和成绩最低学生的姓名和学号。输入格式:每个测试输入包含1个测试用例,格式为\ 第1行:正整数n 第2行:第1个学生的姓名 学号 成绩 第3行:第2个学生的姓名 学号 成绩 ... ... ... 第n+1行:第n个学生的姓名 学号 成绩其中姓名和学号均为不超过10个字符的字符串,成绩为0到1...原创 2018-07-13 15:10:02 · 271 阅读 · 0 评论 -
PAT A1046 Shortest Distance(20)
1046 Shortest Distance (20)(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 Sp...原创 2018-07-26 11:05:08 · 144 阅读 · 0 评论 -
PAT A1065(20) A+B AND C
1065 A+B and C (64bit) (20)(20 分)提问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 posit...原创 2018-07-26 15:42:26 · 160 阅读 · 0 评论 -
C++标准模板库(STL)之VECTOR
vector添加vector头文件即#include <vector> 还需要在头文件下面加一句 using namespace std;1.定义 vrctor<typename> name; vector<int> vt;2.vector容器内元素的访问 (1)通过下标访问 vt(n);即可访问...原创 2018-10-15 18:27:10 · 182 阅读 · 0 评论