当前位置:网站首页>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);
}
边栏推荐
- Sword finger offer 20 String representing numeric value
- Hamburg University of Technology (tuhh) | intelligent problem solving as integrated hierarchical reinforcement learning
- Intel's new GPU patent shows that its graphics card products will use MCM Packaging Technology
- 中電資訊-信貸業務數字化轉型如何從星空到指尖?
- Maximum likelihood method, likelihood function and log likelihood function
- G3 boiler water treatment registration examination and G3 boiler water treatment theory examination in 2022
- Network communication basic kit -- IPv4 socket structure
- What are the advantages and disadvantages of data center agents?
- Design and implementation of redis 7.0 multi part AOF
- Jerry's watch information type table [chapter]
猜你喜欢
Applet graduation design is based on wechat course appointment registration. Applet graduation design opening report function reference
Take you to master the formatter of visual studio code
Small program graduation project based on wechat video broadcast small program graduation project opening report function reference
SQL statement
The contact data on Jerry's management device supports reading and updating operations [articles]
JVM performance tuning and practical basic theory - medium
Remember a lazy query error
Push technology practice | master these two tuning skills to speed up tidb performance a thousand times!
Should enterprises start building progressive web applications?
17. File i/o buffer
随机推荐
2022 new examination questions for safety management personnel of hazardous chemical business units and certificate examination for safety management personnel of hazardous chemical business units
Sequence sorting of basic exercises of test questions
求esp32C3板子連接mssql方法
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
From the 18th line to the first line, the new story of the network security industry
Feign implements dynamic URL
[leetcode daily question] a single element in an ordered array
Small program graduation project based on wechat video broadcast small program graduation project opening report function reference
FRP intranet penetration
[Yugong series] February 2022 attack and defense world advanced question misc-84 (MySQL)
Douban scoring applet Part-3
Ceramic metal crowns - current market situation and future development trend
Question C: Huffman tree
Data collection and summary
Libcblas appears when installing opencv import CV2 so. 3:cannot open shared object file:NO such file or directory
Feign implements dynamic URL
Pytoch residual network RESNET
C learning notes: C foundation - Language & characteristics interpretation
Yyds dry goods inventory it's not easy to say I love you | use the minimum web API to upload files
A fan summed up so many interview questions for you. There is always one you need!