PAT甲级——1041 Be Unique】的更多相关文章

1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10​4​​]. The first one who bets on a unique number wins. For…
1041 Be Unique (20 分)   Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1]. The first one who bets on a unique number wins. For examp…
1041 Be Unique Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10​4​​]. The first one who bets on a unique number wins. For example…
https://pintia.cn/problem-sets/994805342720868352/problems/994805444361437184 Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 10^4…
题目链接 https://www.patest.cn/contests/pat-a-practise/1041 思路 可以用 map 标记 每个数字的出现次数 然后最后再 遍历一遍 找到那个 第一个 第一次出现的数字 AC代码 #include <cstdio> #include <cstring> #include <ctype.h> #include <cstdlib> #include <cmath> #include <climit…
1041. Be Unique (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen fr…
题目链接:http://pat.zju.edu.cn/contests/pat-a-practise/1041 题目描述: Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 104]. The first one…
Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1]. The first one who bets on a unique number wins. For example, if there are 7 peopl…
Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1]. The first one who bets on a unique number wins. For example, if there are 7 peopl…
题目 Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1, 10^4]. The first one who bets on a unique number wins. For example, if there ar…
PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10 4 ]. The first…
1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10​4​​]. The first one who bets on a unique number wins. For…
1041 Be Unique(20 分) Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10​4​​]. The first one who bets on a unique number wins. For e…
博主欢迎转载,但请给出本文链接,我尊重你,你尊重我,谢谢~http://www.cnblogs.com/chenxiwenruo/p/6102219.html特别不喜欢那些随便转载别人的原创文章又不给出链接的所以不准偷偷复制博主的博客噢~~ 时隔两年,又开始刷题啦,这篇用于PAT甲级题解,会随着不断刷题持续更新中,至于更新速度呢,嘿嘿,无法估计,不知道什么时候刷完这100多道题. 带*的是我认为比较不错的题目,其它的难点也顶多是细节处理的问题~ 做着做着,发现有些题目真的是太水了,都不想写题解了…
准备每天刷两题PAT真题.(一句话题解) 1001 A+B Format  模拟输出,注意格式 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; string ans = ""; int main() { ; cin >> a >> b; c = a + b; ) {…
树(23) 备注 1004 Counting Leaves   1020 Tree Traversals   1043 Is It a Binary Search Tree 判断BST,BST的性质 1053 Path of Equal Weight   1064 Complete Binary Search Tree 完全二叉树的顺序存储,BST的性质 1066 Root of AVL Tree 构建AVL树,模板题,需理解记忆 1079 Total Sales of Supply Chain…
PAT甲级:1089 Insert or Merge (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, finds the loca…
PAT甲级:1064 Complete Binary Search Tree (30分) 题干 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 the node's key. The right subtre…
1041 Be Unique (20 分) Being unique is so important to people on Mars that even their lottery is designed in a unique way. The rule of winning is simple: one bets on a number chosen from [1,10​4​​]. The first one who bets on a unique number wins. For…
PAT甲级1131. Subway Map 题意: 在大城市,地铁系统对访客总是看起来很复杂.给你一些感觉,下图显示了北京地铁的地图.现在你应该帮助人们掌握你的电脑技能!鉴于您的用户的起始位置,您的任务是找到他/她目的地的最快方式. 输入规格: 每个输入文件包含一个测试用例.对于每种情况,第一行包含正整数N(<= 100),地铁线数.然后N行跟随,第i(i = 1,...,N)行以格式描述第i条地铁线: M S [1] S [2] ... S [M] 其中M(<= 100)是停止次数,S [i…
PAT甲级1127. ZigZagging on a Tree 题意: 假设二叉树中的所有键都是不同的正整数.一个唯一的二叉树可以通过给定的一对后序和顺序遍历序列来确定.这是一个简单的标准程序,可以按顺序打印数字.但是,如果您认为问题太简单,那么您太天真了. 这次你应该以"锯齿形顺序"打印数字 - 也就是说,从根开始,逐级打印数字,从左到右交替,从右到左.例如,对于以下树,您必须输出:1 11 5 8 17 12 20 15. 输入规格: 每个输入文件包含一个测试用例.对于每种情况,第…
PAT甲级1123. Is It a Complete AVL Tree 题意: 在AVL树中,任何节点的两个子树的高度最多有一个;如果在任何时候它们不同于一个,则重新平衡来恢复此属性.图1-4说明了旋转规则. 现在给出一系列插入, 您应该输出生成的AVL树的级别遍历序列,并告知它是否是完整的二叉树. 输入规格: 每个输入文件包含一个测试用例.对于每种情况,第一行包含正整数N(<= 20). 一行中的所有数字都以空格分隔. 输出规格: 对于每个测试用例,将键逐个插入到初始空的AVL树中.然后首先…
PAT甲级1119. Pre- and Post-order Traversals 题意: 假设二叉树中的所有键都是不同的正整数.一个唯一的二进制树可以通过给定的一对后序和顺序遍历序列来确定,也可以通过预序和顺序遍历序列来确定.然而,如果仅给出了后序和预序遍历序列,则相应的树可能不再是唯一的. 现在给出一对postorder和preorder遍历序列,你应该输出树的相应的顺序遍历序列.如果树不是唯一的,只需输出任何一个树. 输入规格: 每个输入文件包含一个测试用例.对于每种情况,第一行给出正整数…
PAT甲级1114. Family Property 题意: 这一次,你应该帮我们收集家族财产的数据.鉴于每个人的家庭成员和他/她自己的名字的房地产(房产)信息,我们需要知道每个家庭的规模,以及他们的房地产的平均面积和数量. 输入规格: 每个输入文件包含一个测试用例.对于每种情况, 第一行给出正整数N(<= 1000).然后N行跟随,每个给出一个拥有庄园的人的信息,格式如下: ID父亲母亲k Child1 ... Childk M_estate Area 其中ID是每个人唯一的4位数识别号码;父…
PAT甲级1111. Online Map 题意: 输入我们当前的位置和目的地,一个在线地图可以推荐几条路径.现在你的工作是向你的用户推荐两条路径:一条是最短的,另一条是最快的.确保任何请求存在路径. 输入规格: 每个输入文件包含一个测试用例.对于每种情况, 第一行给出两个正整数N(2 <= N <= 500),M分别是地图上街道交叉路口的总数和街道数.然后M行跟随,每个描述一个街道的格式: V1 V2单程长度时间 其中V1和V2是街道两端的索引(从0到N-1);一- 方式是1,如果街道从V1…
PAT甲级1107. Social Clusters 题意: 当在社交网络上注册时,您总是被要求指定您的爱好,以便找到一些具有相同兴趣的潜在朋友.一个"社会群体"是一群拥有一些共同兴趣的人.你应该找到所有的集群. 输入规格: 每个输入文件包含一个测试用例.对于每个测试用例, 第一行包含一个正整数N(<= 1000),一个社交网络中的总人数.因此,人数从1到N.然后N行跟随,每个给出一个人的爱好列表的格式: Ki:hi [1] hi [2] ... hi [Ki] 其中Ki(>…
PAT甲级1103. Integer Factorization 题意: 正整数N的K-P分解是将N写入K个正整数的P次幂的和.你应该写一个程序来找到任何正整数N,K和P的N的K-P分解. 输入规格: 每个输入文件包含一个测试用例,它给出一行三个正整数N(<= 400), K(<= N)和P(1 <P <= 7).一行中的数字用空格分隔. 输出规格: 对于每种情况,如果解决方案存在,输出格式如下: N = n1 ^ P + ... nK ^ P 其中ni(i = 1,... K)是…
PAT甲级1098. Insertion or Heap Sort 题意: 根据维基百科: 插入排序迭代,消耗一个输入元素每次重复,并增加排序的输出列表.在每次迭代中,插入排序从输入数据中删除一个元素,在排序列表中找到它所属的位置,并将其插入到其中.它重复,直到没有输入元素保留. 堆排序将其输入分成排序和未排序的区域,并且通过提取最大的元素并将其移动到排序的区域来迭代地缩小未排序的区域.它涉及使用堆数据结构而不是线性时间搜索来查找最大值. 现在给出整数的初始序列, 连同一些序列,这是一些排序方法…
PAT甲级1095. Cars on Campus 题意: 浙江大学有6个校区和很多门.从每个门口,我们可以收集穿过大门的汽车的进/出时间和车牌号码.现在有了所有的信息,你应该在任何特定的时间点告诉在校园停车的数量, 在一天结束时,发现停车时间最长的汽车. 输入规格: 每个输入文件包含一个测试用例.每个案例从两个正整数N(<= 10000)开始,记录数,K(<= 80000)查询次数.然后按N行,每个都以格式记录 plate_number hh:mm:ss status 其中plate_num…
PAT甲级1089. Insert or Merge 题意: 根据维基百科: 插入排序迭代,消耗一个输入元素每次重复,并增加排序的输出列表.每次迭代,插入排序从输入数据中删除一个元素,在排序列表中找到它所属的位置,并将其插入到该列表中.它重复,直到没有输入元素保留. 合并排序工作如下:将未排序的列表分为N个子列表,每个子列表包含1个元素(1个元素的列表被视为排序).然后重复合并两个相邻的子列表以生成新的排序子列表,直到只剩下1个子列表. 现在给出整数的初始序列, 连同一些序列,这是一些排序方法的…