当前位置:网站首页>PTA tiantisai l1-079 tiantisai's kindness (20 points) detailed explanation
PTA tiantisai l1-079 tiantisai's kindness (20 points) detailed explanation
2022-07-04 02:12:00 【Ceylan_】
The ladder race is a kind race . The kind proposition group hopes to control the difficulty of the topic within a range , So that each participating student has a topic that can be done , And the best students have to work very hard to get high marks .
So the proposition group first divides the programming ability into 106 Level ( It's crazy , It's a fake ), Then we investigated the programming ability of each participating student. . Now please write a program to find out the minimum and maximum abilities of all participating students , Give the proposition group as a reference .
Input format :
Input gives a positive integer in the first line N(≤2×104), That is, the total number of students participating . The next line shows N No more than one. 106 The positive integer , Is the ability value of the participating students .
Output format :
The first line outputs the minimum ability value of all participating students , And the number of students with this ability value . The second line outputs the maximum ability value of all participating students , And the number of students with this ability value . Peer numbers are separated by 1 Space separation , There must be no extra space at the beginning and end of the line .
sample input :
10
86 75 233 888 666 75 886 888 75 666
sample output :
75 3
888 2
Detailed code :
#include <stdio.h>
int main()
{
int n, a[20000], max = 0, min = 2000000, mi = 0, ma = 0;
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
for (int i = 0; i < n; i++)
{
if (a[i] > max)
max = a[i];
if (a[i] < min)
min = a[i];
}
for (int i = 0; i < n; i++)
{
if (a[i] == max)
ma++;
if (a[i] == min)
mi++;
}
printf("%d %d\n", min, mi);
printf("%d %d\n", max, ma);
}
边栏推荐
- Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine
- Should enterprises start building progressive web applications?
- IPv6 experiment
- Global and Chinese market of box seals 2022-2028: Research Report on technology, participants, trends, market size and share
- Sword finger offer 20 String representing numeric value
- Network communication basic kit -- IPv4 socket structure
- Conditional statements of shell programming
- Winter vacation daily question -- a single element in an ordered array
- String: LV1 eat hot pot
- Containerization technology stack
猜你喜欢
The reasons why QT fails to connect to the database and common solutions
On Valentine's day, I code a programmer's exclusive Bing Dwen Dwen (including the source code for free)
在尋求人類智能AI的過程中,Meta將賭注押向了自監督學習
Dans la recherche de l'intelligence humaine ai, Meta a misé sur l'apprentissage auto - supervisé
Small program graduation project based on wechat examination small program graduation project opening report function reference
Maximum likelihood method, likelihood function and log likelihood function
FRP intranet penetration
C learning notes: C foundation - Language & characteristics interpretation
[leetcode daily question] a single element in an ordered array
Write the first CUDA program
随机推荐
What are the advantages and disadvantages of data center agents?
Global and Chinese market of box seals 2022-2028: Research Report on technology, participants, trends, market size and share
Douban scoring applet Part-3
Iclr2022 | ontoprotein: protein pre training integrated with gene ontology knowledge
Small program graduation project based on wechat video broadcast small program graduation project opening report function reference
Introduction to graphics: graphic painting (I)
Description of setting items of Jerry [chapter]
Global and Chinese markets of advanced X-ray inspection system (Axi) in PCB 2022-2028: Research Report on technology, participants, trends, market size and share
G3 boiler water treatment registration examination and G3 boiler water treatment theory examination in 2022
Jerry's watch listens to the message notification of the target third-party software and pushes the message to the device [article]
mysql使用視圖報錯,EXPLAIN/SHOW can not be issued; lacking privileges for underlying table
Design and implementation of redis 7.0 multi part AOF
Network byte order
Final consistency of MESI cache in CPU -- why does CPU need cache
Containerization technology stack
Example 072 calculation of salary it is known that the base salary of an employee of a company is 500 yuan. The amount of software sold by the employee and the Commission method are as follows: Sales
60 year old people buy medical insurance and recommend a better product
Career development direction
C learning notes: C foundation - Language & characteristics interpretation
Feign implements dynamic URL