甲级emergency 1003 pat

P1003题解

简单模拟题。 思路 枚举每一个地毯,因为后面的会覆盖前面的,所以从正序枚举。如果要求的点的坐标在当前地毯上,则将答案赋值为当前地毯编号。 最后输出答案。 那如果这个点没有地毯呢?答案初始设为 \(-1\),这样没有地毯覆盖的话,答案不会改变,这样输出答案就会是 \(-1\)。 注意: 记得赋初始值。 ......
题解 P1003 1003

[emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size:32

解决nginx报错 nginx: [emerg] could not build server_names_hash, you should increase server_nam es_hash_bucket_size: 32 nginx: configuration file xxxx/conf ......

PAT甲级 1002 A+B for Polynomials

原题链接: 本题需要将相同次数的项进行相加,因此在初始输入的时候就直接用数组记录每个次数项,下标为次数,值为对应次数项的值(用+=) 遍历整个数组,看有几个元素非0即可知非0项的个数。 因要求降幂输出,则从后向前遍历,输出每个元素的下标和值。 #include <bits/stdc++.h> usi ......
甲级 Polynomials 1002 PAT for

PAT 1099 Build A Binary Search Tree

1099 Build A Binary Search Tree 30分 题目描述:告诉了BST的结点下标关系、结点值,求BST的层次遍历序列。 vector<int> in; // 保存中序序列 int Tree[105][2]; // 保存结点与左右孩子结点之间的下标 map<int,vector ......
Binary Search Build 1099 Tree

启动nginx报错nginx: [emerg] unexpected end of file, expecting "}" in /usr/local/nginx/conf/nginx.conf:

启动nginx报错:“nginx: [emerg] unexpected end of file, expecting “}” in /usr/local/nginx/conf/nginx.conf:118”重启nginx时,报这么个错: [root@localhost conf]# /usr/lo ......
nginx conf quot unexpected expecting

PAT_A1015 Reversible Primes

A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re ......
Reversible Primes PAT_A 1015 PAT

PAT甲级:1174 Left-View of Binary Tree

题目:1174 Left-View of Binary Tree 25分 题解:层次遍历输出每一行最左边的元素。(最开始以为输出部分节点的左子树...想不到思路) using namespace std; #include <iostream> #include <vector> #include ......
甲级 Left-View Binary 1174 Left

PAT_A1081 Rational Sum

1、 #分数 本题主要考察分数的运算,和分数的输出 2、数据范围为int,但两分母相乘时,最大可达到long long,应该用long long 3、测试点4会检查0的输出。 ......
Rational PAT_A 1081 PAT Sum

PAT 甲级【1015 Reversible Primes】

考察素数判断 考察进制转换 import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class Main { @SuppressWarnings("unc ......
甲级 Reversible Primes 1015 PAT

PAT甲级【1014 Waiting in Line】

考察双向链表 import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; import java.util.LinkedList; public class Main { ......
甲级 Waiting 1014 Line PAT

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" ......
甲级 Battle Cities 1013 Over

PAT_B1008 数组元素循环右移问题

一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置,即将A中的数据由(A0​A1​⋯AN−1​)变换为(AN−M​⋯AN−1​A0​A1​⋯AN−M−1​)(最后M个数循环移至最前面的M个位置)。如果需要考虑程序移动数据的次数尽量少,要如何设计移动的 ......
数组 元素 问题 PAT_B 1008

PAT_A1049 Counting Ones【困难】

数学问题/简单数学 需要严格推理,具体见算法笔记上机指南p199.每次迭代,记录当前位出现1的个数;对当前位的数分三种情况讨论。 ......
Counting PAT_A 1049 Ones PAT

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 ......
Segments Number PAT_A 1104 PAT

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 ......
甲级 1012 Best Rank PAT

PAT_B1003 我要通过!

“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 字符串中必须仅有 P、 A、 T这三种字符,不可以包含其它字符; 任意形如 xPATx 的字符串都 ......
我要 PAT_B 1003 PAT

PAT 甲级【1011 World Cup Betting】

import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class Main { @SuppressWarnings("unchecked") publi ......
甲级 Betting World 1011 PAT

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 ......
甲级 Radix 1010 PAT

PAT_A1029 Median

two_pointers;令两个序列的最后都添加一个很大的数作为哨兵节点,可以简化代码,解决数组问题;使用cin、cout会超时。 ......
Median PAT_A 1029 PAT

PAT 甲级【1009 Product of Polynomials】

/* 系数为0不输出 貌似runtime异常也显示答案不正确*/import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamToke ......
甲级 Polynomials Product 1009 PAT

PAT 甲级1008【1008 Elevator】

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.StreamTokenizer; public class Main { @Supp ......
甲级 1008 Elevator PAT

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 ......
Insert PAT_A Merge 1089 PAT

PAT 甲级【1007 Maximum Subsequence Sum】

本题是考察动态规划与java的快速输入: max[i]表示第i个结尾的最大的连续子串和。b begin[i]表示第[begin[i],i]为最大和的开始位置 超时代码: import java.io.BufferedReader; import java.io.IOException; import ......
甲级 Subsequence Maximum 1007 PAT

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 ......
Shopping PAT_A 1044 Mars PAT

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 ......
甲级 1005 Spell Right PAT

PAT 甲级考试【1003 Emergency】

PAT 甲级考试: dfs+dijktasla算法。 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.*; public cla ......
甲级 Emergency 1003 PAT

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 ......
PAT_A Radix 1010 PAT

CF1003E Tree Constructing

很trivial的构造题 首先上来判掉一些显然无解的情况,然后考虑既然最后直径长为\(d\)那么不妨先搞一条长度为\(d\)的链来 考虑在链上接一些点使得直径不会变长,对于链上的某个点,它最多能接上的链的长度就是它到两个端点距离的最小值 不妨设计递归函数求解,设solve(x,dis,lim)表示在 ......
Constructing 1003E 1003 Tree CF

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 ......
Sequence Perfect PAT_A 1085 PAT

华为路由器配置NAT,PAT

NAT概述 NAT(Network Address Translation)又称为网络地址转换,用于实现私有网络和公有网络之间的互访。 私有网络地址和公有网络地址 私有网络地址(以下简称私网地址)是指内部网络或主机的IP地址,公有网络地址(以下简称公网地址)是指在互联网上全球唯一的IP地址。IANA ......
路由 路由器 NAT PAT
共200篇  :1/7页 首页上一页1下一页尾页