basic 1101 pat
PAT 甲级【1015 Reversible Primes】
考察素数判断 考察进制转换 import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class Main { @SuppressWarnings("unc ......
PAT甲级【1014 Waiting in Line】
考察双向链表 import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.util.LinkedList; public class Main { ......
PAT 甲级【1013 Battle Over Cities】
本题就是dfs.连通图个数-2; 但是java慢,最后一个case 超时 import java.io.*; import java.util.HashSet; import java.util.Set; public class Main { @SuppressWarnings("uncheck" ......
PAT_B1008 数组元素循环右移问题
一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置,即将A中的数据由(A0A1⋯AN−1)变换为(AN−M⋯AN−1A0A1⋯AN−M−1)(最后M个数循环移至最前面的M个位置)。如果需要考虑程序移动数据的次数尽量少,要如何设计移动的 ......
PAT_A1049 Counting Ones【困难】
数学问题/简单数学 需要严格推理,具体见算法笔记上机指南p199.每次迭代,记录当前位出现1的个数;对当前位的数分三种情况讨论。 ......
PAT_A1104 Sum of Number Segments
Given a sequence of positive numbers, a segment is defined to be a consecutive subsequence. For example, given the sequence { 0.1, 0.2, 0.3, 0.4 }, we ......
PAT 甲级【1012 The Best Rank】
本题用java极容易超时,提交了好几次才成功 另外90 88 77 77 50,名次应该是1 2 3 3 5 ,不是1 2 3 3 4 import java.io.*; public class Main { @SuppressWarnings("unchecked") public static ......
PAT_B1003 我要通过!
“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 字符串中必须仅有 P、 A、 T这三种字符,不可以包含其它字符; 任意形如 xPATx 的字符串都 ......
PAT 甲级【1011 World Cup Betting】
import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class Main { @SuppressWarnings("unchecked") publi ......
PAT 甲级【1010 Radix】
本题范围long型(35)^10 枚举radix范围上限pow(n/a0,1/m)上,考虑上限加1.范围较大。使用二分查找枚举 代码如下 import java.io.BufferedReader; import java.io.IOException; import java.io.InputSt ......
PAT_A1029 Median
two_pointers;令两个序列的最后都添加一个很大的数作为哨兵节点,可以简化代码,解决数组问题;使用cin、cout会超时。 ......
PAT 甲级【1009 Product of Polynomials】
/* 系数为0不输出 貌似runtime异常也显示答案不正确*/import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamToke ......
PAT 甲级1008【1008 Elevator】
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class Main { @Supp ......
PAT_A1089 Insert or Merge
According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insert ......
PAT 甲级【1007 Maximum Subsequence Sum】
本题是考察动态规划与java的快速输入: max[i]表示第i个结尾的最大的连续子串和。b begin[i]表示第[begin[i],i]为最大和的开始位置 超时代码: import java.io.BufferedReader; import java.io.IOException; import ......
PAT_A1044 Shopping in Mars
Shopping in Mars is quite a different experience. The Mars people pay by chained diamonds. Each diamond has a value (in Mars dollars M$). When making ......
PAT 甲级1005【1005 Spell It Right】
用JAVA可以用BigInteger解决。 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigInteger; import ......
PAT 甲级考试【1003 Emergency】
PAT 甲级考试: dfs+dijktasla算法。 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public cla ......
PAT_A 1010 Radix
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 ......
Greedy algorithm basic principle
贪心算法是以动态规划方法为基础的,在每个贪心算法之下,几乎总有一个更繁琐的动态规划算法。 贪心算法和动态规划不同之处在于:是否需要考虑子问题的解 贪心算法并不考虑子问题,直接在当前步骤中做出选择 动态规划无论是自底向上, 贪心算法设计步骤 将最优化问题转化为这样的形式:对其做出一次选择后,只剩下一个 ......
Dynamic programming basic principle
There is a confusing question, i.e. the name of this method is dynamic programming, how can we understand it ? The dynamic programming in chinese is " ......
PAT_A 1085 Perfect Sequence
Given a sequence of positive integers and another positive integer p. The sequence is said to be a perfect sequence if M≤m×p where M and m are the max ......
华为路由器配置NAT,PAT
NAT概述 NAT(Network Address Translation)又称为网络地址转换,用于实现私有网络和公有网络之间的互访。 私有网络地址和公有网络地址 私有网络地址(以下简称私网地址)是指内部网络或主机的IP地址,公有网络地址(以下简称公网地址)是指在互联网上全球唯一的IP地址。IANA ......
PAT_A 1038 Recover the Smallest Number
Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we c ......
PAT_A1067 Sort with Swap(0, i)
使用p数组存放各元素当前所处位置,e数组在这里无用。在寻找没有归位的元素时,如果每次从头开始寻找会超时。 ......
Secure Code Warrior C# Basic OWASP Web Top 10 2017 8: Insecure deserialization, 9: Using Components with Known Vulnerabilities, 10: Insufficient Logging and Monitoring
Last but not least. These set challenges consist of 8: Insecure deserialization, 9: Using Components with Known Vulnerabilities, 10: Insufficient Logg ......
Secure Code Warrior C# Basic OWASP Web Top 10 2017 5: Broken Access Control, 6: Security Misconfiguration and 7: XSS vulnerabilities
Learn the ropes or hone your skills in secure programming here. These challenges will give you an understanding of 5: Broken Access Control, 6: Securi ......
Secure Code Warrior C# Basic OWASP Web Top 10 2017 1: Injection Flaws and 2: Broken Authentication vulnerabilities 3: Sensitive Data Exposure and 4: XXE vulnerabilities
Let's continue with some other very common application weaknesses. This set of levels will focus on 3: Sensitive Data Exposure and 4: XXE vulnerabilit ......
Secure Code Warrior C# Basic OWASP Web Top 10 2017 1: Injection Flaws and 2: Broken Authentication vulnerabilities
Let's start with the most critical application weaknesses. These challenges get you the foundations of 1: Injection Flaws and 2: Broken Authentication ......
PAT_A1070 Mooncake
Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional ......