pat解题报告【1082】】的更多相关文章

1082. Read Number in Chinese (25) 时间限制   400 ms 内存限制   32000 kB 代码长度限制   16000 B 判题程序     Standard     作者     CHEN, Yue Given an integer with no more than 9 digits, you are supposed to read it in the traditional Chinese way.  Output "Fu" first i…
1052. Linked List Sorting (25) 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 given a linked list, yo…
1051. Pop Sequence (25) Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, if…
1050. String Subtraction (20) Given two strings S1 and S2, S = S1 - S2 is defined to be the remaining string after taking all the characters in S2 from S1. Your task is simply to calculate S1 - S2 for any given strings. However, it might not be that…
1049. Counting Ones (30) The task is simple: given any positive integer N, you are supposed to count the total number of 1's in the decimal form of the integers from 1 to N. For example, given N being 12, there are five 1's in 1, 10, 11, and 12. Inpu…
1048. Find Coins (25) Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However, there was a special require…
1047. Student List for Course (25) Zhejiang University has 40000 students and provides 2500 courses. Now given the registered course list of each student, you are supposed to output the student name lists of all the courses. Input Specification: Each…
1013. Battle Over Cities (25) t is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we need to repair any other…
1010. Radix (25) Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number. Now for any pair of positive integers N1 and N2, your task i…
This time, you are supposed to find A*B where A and B are two polynomials. Input Specification: Each input file contains one test case. Each case occupies 2 lines, and each line contains the information of a polynomial: K N1 aN1 N2 aN2 ... NK aNK, wh…
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 Subsequence is the continuous subsequence which has the largest sum of its elements. For examp…
1003. Emergency (25) As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some roads. Amount of rescue teams in each city and the length of each road between an…
1004. Counting Leaves (30) A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child. Input Each input file contains one test case. Each case starts with a line containing 0 < N < 100, th…
今天下午的PAT考试状态不理想,回来怒刷了一遍,解题报告如下: 1073. Scientific Notation (20) 基本模拟题,将一长串的科学计数转换为普通的数字表示方式.思路是是数组存储输入,然后找到指数位置,并根据指数的大小和正负对前面的小数进行针对性的处理. #include <iostream> #include <cstring> #include <algorithm> using namespace std; class PAT{ public:…
最近CH上的比赛很多,在此会全部写出解题报告,与大家交流一下解题方法与技巧. T1 魔幻森林 描述 Cortana来到了一片魔幻森林,这片森林可以被视作一个N*M的矩阵,矩阵中的每个位置上都长着一棵树,其中一些树上结有能够产生能量的魔力水果.已知每个水果的位置(Xi,Yi)以及它能提供的能量Ci.然而,魔幻森林在某些时候会发生变化:(1) 有两行树交换了位置.(2) 有两列树交换了位置.当然,树上结有的水果也跟随着树一起移动.不过,只有当两行(列)包含的魔力水果数都大于0,或者两行(列)都没有魔…
二模13day1解题报告 T1.发射站(station) N个发射站,每个发射站有高度hi,发射信号强度vi,每个发射站的信号只会被左和右第一个比他高的收到.现在求收到信号最强的发射站. 我用了时间复杂度比较高(nlogn)的算法.首先按h排序(从高到低),作为算法的一个"输入"序列(记为A)(标记原来位置). 在保存这个序列的基础上,记录rank=1~n,然后按pos排序.排完记为B序列.这时会生成一个关于pos对应h的rank序列,对应B中的每个元素在A中的位置. 用next[i]…
题目直接摆在这里! 1051: [HAOI2006]受欢迎的牛 Time Limit: 10 Sec  Memory Limit: 162 MBSubmit: 4438  Solved: 2353[Submit][Status][Discuss] Description 每一头牛的愿望就是变成一头最受欢迎的牛.现在有N头牛,给你M对整数(A,B),表示牛A认为牛B受欢迎. 这 种关系是具有传递性的,如果A认为B受欢迎,B认为C受欢迎,那么牛A也认为牛C受欢迎.你的任务是求出有多少头 牛被所有的牛…
这次的解题报告是有关tarjan算法的一道思维量比较大的题目(真的是原创文章,希望管理员不要再把文章移出首页). 这道题蒟蒻以前做过,但是今天由于要复习tarjan算法,于是就看到codevs分类强联通分量里面只有这一道题. 题目是这样的: “每个人都拥有一个梦,即使彼此不相同,能够与你分享,无论失败成功都会感动.爱因为在心中,平凡而不平庸,世界就像迷宫,却又让我们此刻相逢Our Home.” 在爱的国度里有N个人,在他们的心中都有着一个爱的名单,上面记载着他所爱的人(不会出现自爱的情况).爱是…
本蒟蒻又来写解题报告了.这次的题目是codevs 1035 火车停留. 题目大意就是给m个火车的到达时间.停留时间和车载货物的价值,车站有n个车道,而火车停留一次车站就会从车载货物价值中获得1%的利润,让你来求一种安排方法,使得车站收益最大,并输出收益值. 蒟蒻的思路是这样的: 一眼看出:最大费用最大流(MCMF)显然cost:表示车站收益然后……以车站为点建立图求流?同一个车站可能经过好几辆火车……,貌似很麻烦……:那么以什么建图.连边,还有怎么连?貌似有点类似于方格取数2之中的拆点……:那么…
这道题是受到大犇MagHSK的启发我才得以想出来的,蒟蒻觉得自己的代码跟MagHSK大犇的代码完全比不上,所以这里蒟蒻就套用了MagHSK大犇的代码(大家可以关注下我的博客,友情链接就是大犇MagHSK的博客,大神是山东省队队员,他的博客中的题的质量都比我高几个档次): 这是大神MagHSK的解释:因为10^9顶多开5~6次方就成了1了(当然这里的等于是向下取整的)因此对于修改操作,如果某一段不是1或不是0,就暴力修改,如果是1/0就不管他.修改完之后update一下就好了. 题目上说我们给出的…
今天拿了这道题目练练手,感觉自己代码能力又增强了不少: 我的思路跟别人可能不一样. 首先我们很容易就能看出,我们需要的边就是最小生成树算法kruskal算法求出来的边,其余的边都可以删掉,于是就有了这个kruskal选边建图的过程. struct kruskalsolve{ int l,r,w; }kr[maxm];此处省略的内容接下来会有给出全部代码 int find(int x){ if(f[x] != x)f[x] = find(f[x]); return f[x]; } void kru…
NOIP2016提高组解题报告 更正:NOIP day1 T2天天爱跑步 解题思路见代码. NOIP2016代码整合…
最近在准备找工作的算法题,刷刷LeetCode,以下是我的解题报告索引,每一题几乎都有详细的说明,供各位码农参考.根据我自己做的进度持续更新中......                              本文地址 LeetCode:Reverse Words in a String LeetCode:Evaluate Reverse Polish Notation LeetCode:Max Points on a Line LeetCode:Sort List LeetCode:Ins…
E - Just a Hook Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u   Description In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive m…
beautiful 2.1 题目描述 一个长度为 n 的序列,对于每个位置 i 的数 ai 都有一个优美值,其定义是:找到序列中最 长的一段 [l, r],满足 l ≤ i ≤ r,且 [l, r] 中位数为 ai(我们比较序列中两个位置的数的大小时, 以数值为第一关键字,下标为第二关键字比较.这样的话 [l, r] 的长度只有可能是奇数),r - l + 1 就是 i 的优美值. 接下来有 Q 个询问,每个询问 [l, r] 表示查询区间 [l, r] 内优美值的最大值.2.2 输入 第一行输…
CF一如既往在深夜举行,我也一如既往在周三上午的C++课上进行了virtual participation.这次div2的题目除了E题都水的一塌糊涂,参赛时的E题最后也没有几个参赛者AC,排名又成为了手速与精准的竞争--(遗憾,如果参加了一定可以上分的吧orz) A题: 先判断起点和终点的距离是否被每次跳的距离整除,如果不整除就到不了.再检验跳跃过程中的落点是否均合法即可. #include<stdio.h> #include<bits/stdc++.h> #include <…
---恢复内容开始--- q神等人组织的vjudge上的多校训练,题目基本上都来自于CF,#1是上周进行的,参加后感觉收获很多,因为上周准备期中比较忙,解题报告现在补上. 比赛地址(兼题目地址) A题 DFS搜索所有路径,需要注意的是走的顺序,先向前走一步,再向上或向下或静止不动,由于车一直在走,可以认为是相对运动,即人再向右侧走两个格子.遇到当前位置是车就说明走不通,可以走出的条件是已经在此行所有车的后面. 注意,一定要写visited记录走没走过格子(也就我这种搜索初学者会犯这么傻的错误吧,…
Unique Paths II Total Accepted: 31019 Total Submissions: 110866My Submissions Question Solution  Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty spa…
本章施工仍未完成 现在的时间是3.17 0:28,我困得要死 本来今天(昨天?)晚上的计划是把整个四道题的题解写出来,但是到现在还没写完T4的高效算法,简直悲伤. 尝试了用floyd写T4,终于大功告成AC后,看到别人的解题报告说fl能过只是因为测试数据范围小. 好像主要有三种解法,fl,dij,dfs dfs暂时弃,dij写到现在还没完成,先把fl的放上来. 等攻下T4,再施工前面三道题 T4-Floyd: 读完数据以后,只要把文化不兼容的城市的路都堵上,就可以用floyd了 可怜我之前堵路无…
LeetCode 2 Add Two Sum 解题报告 LeetCode第二题 Add Two Sum 首先我们看题目要求: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return…