PAT
PAT 甲级:1002 A+B for Polynomials,测试点说明
1002 A+B for Polynomials 25分 题解:(类似于把两个多项式合并同类项:指数相同的项把系数相加),最后输出新多项式的项数、各项。 需要注意的测试点: 1.输出的新项格式要与输入的一致:[项数] [指数1] [系数1] [指数2] [系数2] ...;且指数递减 2.指数是整型 ......
PAT乙级真题:1110 区块反转
【1110 区块反转 分值:25 乙级】 题目描述: 给定一个单链表 L,我们将每 K 个结点看成一个区块(链表最后若不足 K 个结点,也看成一个区块),请编写程序将 L 中所有区块的链接反转。 例如:给定 L 为 1→2→3→4→5→6→7→8,K 为 3,则输出应该为 7→8→4→5→6→1→2 ......
PAT单位排行
PAT单位排行 1. 题目地址 https://www.acwing.com/problem/content/1636/ 2. 题目解析 3. 题解 4. 代码 #include <iostream> #include <cstdio> #include <cstring> #include <al ......
1141 PAT Ranking of Institutions(附测试点5分析)
题目: After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ......
PAT-甲级-1007 Maximum Subsequence Sum C++
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 S ......
PAT-甲级-1005 Spell It Right C++
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 Specificat ......
PAT-甲级-1004 Counting Leaves C++
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 inp ......
攀拓(PAT)- 程序设计(乙级)2023年夏季考试仿真卷题解
#B-1 唯手熟尔 思路:getchar一个读入到string中进行判断 代码: ``` #include using i64 = long long; #pragma GCC optimize(2) #define IOS std::ios::sync_with_stdio(false), std ......
PAT Advanced 1012. The Best Rank
# PAT Advanced 1012. The Best Rank ## 1. Problem Description: To evaluate the performance of our first year CS majored students, we consider their gra ......
PAT Advanced 1011. World Cup Betting
# PAT Advanced 1011. World Cup Betting ## 1. Problem Description: With the 2010 FIFA World Cup running, football fans the world over were becoming inc ......
PAT Advanced 1010. Radix
# PAT Advanced 1010. Radix ## 1. Problem Description: Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? Th ......
PAT Advanced 1008. Elevator
PAT Advanced 1008. Elevator 1. Problem Description: The highest building in our city has only one elevator. A request list is made up with $N$ positiv ......
PAT Advanced 1007. Maximum Subsequence Sum
PAT Advanced 1007. Maximum Subsequence Sum 1. Problem Description: Given a sequence of $K$ integers { $N_1, N_2, ..., N_K$ }. A continuous subsequence ......
PAT Advanced 1006. Sign In and Sign Out
PAT Advanced 1006. Sign In and Sign Out 1. Problem Description: At the beginning of every day, the first person who signs in the computer room will un ......
PAT Advanced 1005. Spell It Right
PAT Advanced 1005. Spell It Right 1. Problem Description: Given a non-negative integer $N$, your task is to compute the sum of all the digits of $N$, ......
PAT Advanced 1004. Counting Leaves
PAT Advanced 1004. Counting Leaves 1. Problem Description: A family hierarchy is usually presented by a pedigree tree. Your job is to count those fami ......
PAT Advanced 1003. Emergency
PAT Advanced 1003. Emergency 1. Problem Description: As an emergency rescue team leader of a city, you are given a special map of your country. The ma ......
菜鸟记录:c语言实现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 ou ......
PAT Advanced 1002. A+B for Polynomials
PAT Advanced 1002. A+B for Polynomials 1. Problem Description: This time, you are supposed to find $A+B$ where $A$ and $B$ are two polynomials. 2. Inp ......
PAT Advanced 1001. A+B Format
PAT Advanced 1001. A+B Format 0. 写在前面: 没想到这么快就回来了(才不是因为C++ Primer, 5th太厚了doge),之前陆续看了一半的C++ Primer 5th,但真的看不动了。。。类的构造,模板这些真的顶不住,而且我确信如果继续看另一半,看完的这一半也会 ......
迁移学习(PAT)《Pairwise Adversarial Training for Unsupervised Class-imbalanced Domain Adaptation》
论文信息 论文标题:Pairwise Adversarial Training for Unsupervised Class-imbalanced Domain Adaptation论文作者:Weili Shi, Ronghang Zhu, Sheng Li论文来源:KDD 2022论文地址:dow ......
PAT-basic-1034 有理数四则运算
一、题目 本题要求编写程序,计算 2 个有理数的和、差、积、商。 输入格式: 输入在一行中按照 a1/b1 a2/b2 的格式给出两个分数形式的有理数,其中分子和分母全是整型范围内的整数,负号只可能出现在分子前,分母不为 0。 输出格式: 分别在 4 行中按照 有理数1 运算符 有理数2 = 结果 ......
PAT-basic-1021 个位数统计
一、题目 给定一个 k 位整数 N=dk−110k−1+⋯+d1101+d0 (0≤di≤9, i=0,⋯,k−1, dk−1>0),请编写程序统计每种不同的个位数字出现的次数。例如:给定 N=100311,则有 2 个 0,3 个 1,和 1 个 3。 输入格式: 每个输入包含 1 个测 ......
PAT-basic-1040 有几个PAT
一、题目 字符串 APPAPT 中包含了两个单词 PAT,其中第一个 PAT 是第 2 位(P),第 4 位(A),第 6 位(T);第二个 PAT 是第 3 位(P),第 4 位(A),第 6 位(T)。 现给定字符串,问一共可以形成多少个 PAT? 输入格式: 输入只有一行,包含一个字符串,长度 ......
PAT-basic-1038 统计同成绩学生
一、题目 本题要求读入 N 名学生的成绩,将获得某一给定分数的学生人数输出。 输入格式: 输入在第 1 行给出不超过 105 的正整数 N,即学生总人数。随后一行给出 N 名学生的百分制整数成绩,中间以空格分隔。最后一行给出要查询的分数个数 K(不超过 N 的正整数),随后是 K 个分数,中间以空格 ......
PAT-basic-1039 到底买不买
一、题目 小红想买些珠子做一串自己喜欢的珠串。卖珠子的摊主有很多串五颜六色的珠串,但是不肯把任何一串拆散了卖。于是小红要你帮忙判断一下,某串珠子里是否包含了全部自己想要的珠子?如果是,那么告诉她有多少多余的珠子;如果不是,那么告诉她缺了多少珠子。 为方便起见,我们用[0-9]、[a-z]、[A-Z] ......
PAT-basic-1037 在霍格沃茨找零钱
一、题目 如果你是哈利·波特迷,你会知道魔法世界有它自己的货币系统 —— 就如海格告诉哈利的:“十七个银西可(Sickle)兑一个加隆(Galleon),二十九个纳特(Knut)兑一个西可,很容易。”现在,给定哈利应付的价钱 P 和他实付的钱 A,你的任务是写一个程序来计算他应该被找的零钱。 输入格 ......
PAT-basic-1035 插入与归并
一、题目 根据维基百科的定义: 插入排序是迭代算法,逐一获得输入数据,逐步产生有序的输出序列。每步迭代中,算法从输入序列中取出一元素,将之插入有序序列中正确的位置。如此迭代直到全部元素有序。 归并排序进行如下迭代操作:首先将原始序列看成 N 个只包含 1 个元素的有序子序列,然后每次迭代归并两个相邻 ......
PAT-basic-1036 跟奥巴马一起编程
一、题目 美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014 年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏幕上画一个正方形。现在你也跟他一起画吧! 输入格式: 输入在一行中给出正方形边长 N(3≤N≤20) ......