当前位置:网站首页>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);
}
边栏推荐
- The latest analysis of hoisting machinery command in 2022 and free examination questions of hoisting machinery command
- Node write API
- What are the advantages and disadvantages of data center agents?
- Iclr2022 | ontoprotein: protein pre training integrated with gene ontology knowledge
- A. Div. 7
- Global and Chinese market of contour projectors 2022-2028: Research Report on technology, participants, trends, market size and share
- Small program graduation project based on wechat examination small program graduation project opening report function reference
- Three layer switching ②
- Key knowledge of C language
- Keep an IT training diary 055- moral bitch
猜你喜欢
Rearrangement of tag number of cadence OrCAD components and sequence number of schematic page
Pytoch residual network RESNET
Life cycle of instance variables, static variables and local variables
String & memory function (detailed explanation)
[Yugong series] February 2022 attack and defense world advanced question misc-84 (MySQL)
Do you know the eight signs of a team becoming agile?
Douban scoring applet Part-3
Final consistency of MESI cache in CPU -- why does CPU need cache
Save Private Ryan - map building + voltage dp+deque+ shortest circuit
Override and virtual of classes in C #
随机推荐
Three layer switching ②
Conditional statements of shell programming
On Valentine's day, I code a programmer's exclusive Bing Dwen Dwen (including the source code for free)
LV1 tire pressure monitoring
Global and Chinese market of cell scrapers 2022-2028: Research Report on technology, participants, trends, market size and share
60 year old people buy medical insurance and recommend a better product
I don't know why it can't run in the project and how to change it
Global and Chinese market for travel wheelchairs 2022-2028: Research Report on technology, participants, trends, market size and share
Do you know the eight signs of a team becoming agile?
Applet graduation design is based on wechat course appointment registration. Applet graduation design opening report function reference
The difference between int (1) and int (10)
C language black Technology: Archimedes spiral! Novel, interesting, advanced~
A fan summed up so many interview questions for you. There is always one you need!
Yyds dry goods inventory it's not easy to say I love you | use the minimum web API to upload files
Portapack application development tutorial (XVII) nRF24L01 launch C
Yyds dry goods inventory override and virtual of classes in C
Sequence sorting of basic exercises of test questions
Setting function of Jerry's watch management device [chapter]
LeetCode 168. Detailed explanation of Excel list name
Node write API