PAT乙级:1090危险品装箱(25分) 题干 集装箱运输货物时,我们必须特别小心,不能把不相容的货物装在一只箱子里.比如氧化剂绝对不能跟易燃液体同箱,否则很容易造成爆炸. 本题给定一张不相容物品的清单,需要你检查每一张集装箱货品清单,判断它们是否能装在同一只箱子里. 输入格式: 输入第一行给出两个正整数:N (≤104) 是成对的不相容物品的对数:M (≤100) 是集装箱货品清单的单数. 随后数据分两大块给出.第一块有 N 行,每行给出一对不相容的物品.第二块有 M 行,每行给出一箱货物的清…
PAT乙级:1070 结绳 (25分) 题干 给定一段一段的绳子,你需要把它们串成一条绳.每次串连的时候,是把两段绳子对折,再如下图所示套接在一起.这样得到的绳子又被当成是另一段绳子,可以再次对折去跟另一段绳子串连.每次串连后,原来两段绳子的长度就会减半. 给定 N 段绳子的长度,你需要找出它们能串成的绳子的最大长度. 输入格式: 每个输入包含 1 个测试用例.每个测试用例第 1 行给出正整数 N (2≤N≤104):第 2 行给出 N 个正整数,即原始绳段的长度,数字间以空格分隔.所有整数都不…
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 contains one test case. For each case, the first line give…
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 contains one test case. For each case, the first line giv…
1040 Longest Symmetric String (25 分)   Given a string, you are supposed to output the length of the longest symmetric sub-string. For example, given Is PAT&TAP symmetric?, the longest symmetric sub-string is s PAT&TAP s, hence you must output 11.…
1062 Talent and Virtue (25 分)   About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about people's talent and virtue. According to his theory, a man being outstanding in both talent and virtue must be a "sage…
1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades are in a given interval. I…
1065 单身狗 (25 分) “单身狗”是中文对于单身人士的一种爱称.本题请你从上万人的大型派对中找出落单的客人,以便给予特殊关爱. 输入格式: 输入第一行给出一个正整数 N(≤ 50 000),是已知夫妻/伴侣的对数:随后 N 行,每行给出一对夫妻/伴侣——为方便起见,每人对应一个 ID 号,为 5 位数字(从 00000 到 99999),ID 间以空格分隔:之后给出一个正整数 M(≤ 10 000),为参加派对的总人数:随后一行给出这 M 位客人的 ID,以空格分隔.题目保证无人重婚或脚…
此题太给其他25分的题丢人了,只值15分 注意要求最终结果最长,而且向下取整 #include<stdio.h> #include<algorithm> using namespace std; float arr[10005]; int main(){ int N;scanf("%d",&N); for(int i=0;i<N;i++)//输入数据 scanf("%f",&arr[i]); sort(arr,arr+N…
1130 Infix Expression (25 分)(找规律.中序遍历) 我是先在CSDN上面发表的这篇文章https://blog.csdn.net/weixin_44385565/article/details/89035813 Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting the preced…