需要零花钱的朋友看过来啦,5元1道python练习题(共4道),只需要做出来就可以了

问题遇到的现象和发生背景

Given an array of integers $A[0..n-1]$ and $m$ queries $b_j$.For each query report is th number $b_j$ is one of elements in $A$.InputThe first input line contains integer $n$ ($1 \le n \le 500$).
Next line contains $n$ integer numbers $A[0..n-1]$ ($0 \le A[i] \le 1000$).The third line contains integer $m$ ($1 \le m \le 500$).
Each of next $m$ lines contains query $b_j$.OutputFor each query output FOUND if required number is in array or MISSED otherwise

输入输出

standard input
5
1 2 3 4 5
5
1
2
6
0
5
standard output
FOUND
FOUND
MISSED
MISSED
FOUND

standard input
5
1 2 1 2 1
5
1
2
1
2
3
standard output
FOUND
FOUND
FOUND
FOUND
MISSED

No1.


len_as = input()
len_a = int(len_as)
str_a = input()
a = str_a.split(' ')

len_bs = input()
len_b = int(len_bs)
arr_b = []
for i in range(len_b):
    str_b = input()
    arr_b.append(str_b)

for i in arr_b:
    if i in a:
        print("FOUND")
    else:
        print("MISSED")
5
1 2 3 4 5
5
1
2
4
5
7
FOUND
FOUND
FOUND
FOUND
MISSED

No2.

len_as = input()
str_a = input()
a = str_a.split(' ')

len_bs = input()
str_b = input()
b = str_b.split(' ')

a.extend(b)
for i in a:
    print(i, end=' ')
1
5
3
1 2 3
5 1 2 3 

Problem 2.1. Merge Sorted Arrays
Input file name: standard input
Output file name: standard output
Time limit: 1 s
Memory limit: 256 MB
Given two sorted arrays of integers $A[0..n-1]$ and $B[0..m-1]$.Output arrya $C[0..n+m-1]$, the result of merging $A$ and $B$.InputThe first input line contains integer $n$ ($1 \le n \le 50,000$).
Next line contains $n$ integer numbers $A[0..n-1]$ ($0 \le A[i] \le 1,000,000$).The third line contains integer $m$ ($1 \le m \le 50,000$).
Next line contains $m$ integer numbers $B[0..m-1]$ ($0 \le B[i] \le 1,000,000$).OutputOutput $n+m$ integers, the merged array.

standard input
4
1 2 3 4
4
5 6 7 8
standard output
1 2 3 4 5 6 7 8

standard input
1
5
10
1 2 3 4 5 6 7 8 9 10
standard output
1 2 3 4 5 6 7 8 9 10

Problem 2.2. Unique elements
Input file name: standard input
Output file name: standard output
Time limit: 2 s
Memory limit: 256 MB
Given an array of integers $A[0..n-1]$. Find number of elements in $A$ that occurs exactly once in this array.InputThe first input line contains integer $n$ ($1 \le n \le 100,000$).Next line contains $n$ integer numbers $A[0..n-1]$ ($0 \le A[i] \le 10^9$).OutputOutput a single integer, number of elements that occurs exactly once in this array.

Examples
standard input
5
1 2 3 4 5
standard output
5

standard input
5
1 2 3 4 4
standard output
3

Problem 2.3. Multiset
Input file name: standard input
Output file name: standard output
Time limit: 2 s
Memory limit: 256 MB
Consider a multiset of integers $S$, the union of $n$ continous intervals of natural numbers:
$$S = [l_1..r_1] \cup [l_2..r_2] \cup [l_3..r_3] \cup \ldots \cup [l_n..r_n].$$Let's call $D$ is a set of unique numbers in $S$. For each number $x$ in $D$ find number if occcurences of $x$ in $S$.InputThe first line contains integer $n$ ($1 \le n \le 100,000$), number of intervals in the union.Each of next $n$ lines contains two integers $l_i$ and $r_i$ ($1 \le l_i \le r_i \le 100,000$), the miminal and the maximal number of the $i$th interval.OutputFor each number $x$ in $D$ print two integers in separate line, number $x$ and number of occurences of $x$ in $S$.

Examples
standard input
3
1 1
3 4
6 9
standard output
1 1
3 1
4 1
6 1
7 1
8 1
9 1

standard input
5
1 10
2 9
3 8
4 7
5 5
standard output
1 1
2 2
3 3
4 4
5 5
6 4
7 4
8 3
9 2
10 1