当前位置:网站首页>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 2Detailed 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);
}
边栏推荐
- On Valentine's day, I code a programmer's exclusive Bing Dwen Dwen (including the source code for free)
- High level application of SQL statements in MySQL database (I)
- Network communication basic kit -- IPv4 socket structure
- [software implementation series] software implementation interview questions with SQL joint query diagram
- Pyrethroid pesticide intermediates - market status and future development trend
- Servlet simple verification code generation
- A. Div. 7
- The reasons why QT fails to connect to the database and common solutions
- What is the student party's Bluetooth headset recommendation? Student party easy to use Bluetooth headset recommended
- Introduction to graphics: graphic painting (I)
猜你喜欢

When tidb meets Flink: tidb efficiently enters the lake "new play" | tilaker team interview

Magical usage of edge browser (highly recommended by program ape and student party)

Feign implements dynamic URL

Idea if a class cannot be found, it will be red

Do you know the eight signs of a team becoming agile?
![After listening to the system clear message notification, Jerry informed the device side to delete the message [article]](/img/0c/52816b75eb702c7c63966578ab4969.jpg)
After listening to the system clear message notification, Jerry informed the device side to delete the message [article]

Life cycle of instance variables, static variables and local variables

Applet graduation project based on wechat selection voting applet graduation project opening report function reference

Chain ide -- the infrastructure of the metauniverse

MySQL workbench use
随机推荐
Global and Chinese market of thin film deposition systems 2022-2028: Research Report on technology, participants, trends, market size and share
Key knowledge of C language
Global and Chinese market of contour projectors 2022-2028: Research Report on technology, participants, trends, market size and share
The reasons why QT fails to connect to the database and common solutions
Huawei cloud micro certification Huawei cloud computing service practice has been stable
14. Process time
Key knowledge of embedded driver
Feign implements dynamic URL
Why is the operation unsuccessful (unresolved) uncaught syntaxerror: invalid or unexpected token (resolved)
A fan summed up so many interview questions for you. There is always one you need!
Question d: Haffman coding
Yyds dry goods inventory it's not easy to say I love you | use the minimum web API to upload files
LV1 tire pressure monitoring
Experimental animal models - current market situation and future development trend
Why can't it run (unresolved)
Comment la transformation numérique du crédit d'information de la Chine passe - t - elle du ciel au bout des doigts?
Hamburg University of Technology (tuhh) | intelligent problem solving as integrated hierarchical reinforcement learning
Dans la recherche de l'intelligence humaine ai, Meta a misé sur l'apprentissage auto - supervisé
求esp32C3板子連接mssql方法
Life cycle of instance variables, static variables and local variables