current position：Home>I have encountered several array problems in C + +. I hope the big God can solve the puzzle. It's best to have comments
I have encountered several array problems in C + +. I hope the big God can solve the puzzle. It's best to have comments
20220202 12:21:08 【CSDN Q & A】
Arrange and judge
describe
There are multiple sets of tests , Each set of tests will give a length of n Array of P, You need to use the program to judge P Whether the number in is a 1n Permutation
（ contain 1n Once each ）.
Input format
The first 1 That's ok ：1 A digital t, Indicates the number of groups tested （1 < t <= 1000）. After that, each group of data has two rows ：
The first 1 That's ok ：1 A digital n, Represents the length of an array （1 < n <= 500）.
The first 2 That's ok ： common n A digital P[i], Space between , The elements of the corresponding array （1 < P[i] <= 10^9）.
Output format
The output, t That's ok , The judgment result corresponding to each group of data , Output “Yes” perhaps "No".
Data range
1 <= t <= 1000,1 < n <= 500,1 < P[i] <= 10^9
sample input
2
4
1 2 4 3
4
1 4 2 2
sample output
Yes
NO
Sample explanation
1 2 4 3 contain 14 Once each , So the output "Yes",
1 4 2 2 It doesn't include 3, an 2 individual 2, So the output "No"
Refer to the answer 1：
Tell me which part you have difficulty with
Refer to the answer 2：
copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.primo.wiki/2022/02/202202021221071330.html
The sidebar is recommended
 How to read text from TXT document, write it into excel and run it in reverse?
 Calculation of joint torque of detal manipulator
 Give a string representing the date and ask what day of the year it is
 [Vue] setting @ media to query font size is not effective
 How to use the ecarts national map to the city? I CV changed other people's codes and key values. Now this is the case
 Hbuilderx
 Design database (agricultural products sales database, clothing sales database and stamen sales database)
 Let's see if the course sequence of distributed architect is correct
 What's the matter with me? Please answer
 Link failure of distributed task scheduling
guess what you like

The bean tag calls auto assembly and has been given a parameterless construction Setget, why is class still null

"The column vectors of a matrix whose determinant is equal to zero may not be linearly correlated"

PTA 71 string sorting (10 points)

Output the full arrangement of all 1 2 3 4 5 in dictionary order

How to create SQL trigger

Stm32tftlcd displays Chinese character scrolling

The format of the command in the CMD window is unclear

What does the class name in the class mean? It's not a variable or a member function

Seems to have started a program called [com,.] Process. But failed to stop it, which is likely to cause a memory leak. Stack trace for Thread:

Object oriented programming questions
Random recommended
 What are the impossible out of stack sequences when a certain in stack sequence is CADB?
 How to do this!
 Given a matrix of N x n, find the matrix after 90 degrees of rotation
 Mac Pro M1 chip 13 inch how to delete non store software?
 Is there any student to answer the single linked list in the data structure
 On the problem of incomplete display of Vue multi selection box data
 About the problem of incomplete data acquisition in Vue's select multiple selection box
 360 fast travel assistant how to delete
 What are the experimental equipment and requirements of C language experiment report
 Why do the left and right shifts of bit operations correspond to decimal multiplication and division
 C language will not be painful, seek solutions
 Trigger implementation inserts some fields of one table into another table
 A sine wave is known, with peak to peak value of 1V and frequency of 10kHz; Now it is necessary to obtain a sine wave with three times the frequency of the sine wave and a peak to peak value of 9V. Circuit diagram and parameter calculation process
 I want to ask whether this SQL statement is correct and can you get data? This error is displayed
 Using function to store and read text file test TXT