• 欢迎访问废江网站,承蒙遇见 QQ群
  • 本站将致力于推送优质的java知识以及算法,开源代码!
pat 520钻石争霸赛

pat 520钻石争霸赛

第一题7-1 自动编程 (5 分)输出语句是每个程序员首先要掌握的语句。Python 的输出语句很简单,只要写一个 print(X) 即可,其中 X 是需要输出的内容。本题就请你写一个自动编程机,对任何一个要输出的整数 N,给出输出这个整数的 Python 语句。输入格式:输入给出一个不超过 10 的5次方正整数输出格式:在一行中打印输出这个整……

Contest1620 – 2020-2021-2学期《Java Web 系统开发》:java基础:字符串

Contest1620 – 2020-2021-2学期《Java Web 系统开发》:java基础:字符串

QuestionA import java.util.*;public class Main { public static void main(String[] args) { Scanner cin = new Scanner(System.in); ……

Merge Sort

Merge Sort

QuestionWrite a program of a Merge Sort algorithm implemented by the following pseudocode. You should also report the number of comparisons in the Merge function. ……

Koch Curve

Koch Curve

QuestionWrite a program which reads an integer n and draws a Koch curve based on recursive calles of depth n.The Koch curve is well known as a kind of fractals.You can draw a Ko……

Exhaustive Search

Exhaustive Search

QuestionWrite a program which reads a sequence A of n elements and an integer M, and outputs “yes” if you can make M by adding elements in A, otherwise “no”……

Allocation

Allocation

QuestionSample Input 15 381739Sample Output 110Sample Input 24 21226Sample Output 26MeaningSolutionCodingSummary……

Dictionary

Dictionary

QuestionYour task is to write a program of a simple dictionary which implements the following instructions:insert str: insert a string str in to the dictionaryfind str: if the d……

Binary Search

Binary Search

QuestionYou are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S……

Linear Search

Linear Search

QuestionYou are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in T which are also in the set S……

Areas on the Cross-Section Diagram

Areas on the Cross-Section Diagram

QuestionAssume that rain is falling endlessly in the region and the water overflowing from the region is falling in the sea at the both sides. For example, for the above cross-s……

使用STL标准库解决之前三个问题

使用STL标准库解决之前三个问题

QuestionStackCoding #include<iostream>#include<stack>#include<cstdio>#include<stdlib.h>using namespace std;stack&……

Doubly Linked List

Doubly Linked List

QuestionYour task is to implement a double linked list.Write a program which performs the following operations:insert x: insert an element with key x into the front of the list.……

Queue(任务题目)

Queue(任务题目)

QuestionTime Limit : 1 sec , Memory Limit : 131072 KB , isSolved :There are n processes in a queue. Each process has namei and timei. The round-robin scheduling handles the proce……

Stack(逆波兰数)

Stack(逆波兰数)

QuestionReverse Polish notation is a notation where every operator follows all of its operands. For example, an expression (1+2)*(5+4) in the conventional Polish notation can be r……

Shell Sort

Shell Sort

Question 1 insertionSort(A, n, g)2 for i = g to n-13 v = A[i]4 j = i - g5 while j >= 0 && A[j] &g……

Stable Sort

Stable Sort

QuestionLet’s arrange a deck of cards. There are totally 36 cards of 4 suits(S, H, C, D) and 9 values (1, 2, … 9). For example, ‘eight of heart’ is represe……

Selection Sort

Selection Sort

QuestionWrite a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: ……

Bubble Sort

Bubble Sort

QuestionWrite a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: ……

Insertion Sort

Insertion Sort

Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following pseudocode: ……

07-图6 旅游规划

07-图6 旅游规划

有了一张自驾旅游路线图,你会知道城市间的高速公路长度、以及该公路要收取的过路费。现在需要你写一个程序,帮助前来咨询的游客找一条出发地和目的地之间的最短路径。如果有若干条路径都是最短的,那么需要输出最便宜的一条路径。输入格式:输入说明:输入数据的第1行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0~(N−1);M……