清华大学机试 最大最小值 Easy

基本思想:

无;

关键点:

无;

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<set>
#include<map>
using namespace std;

const int maxn = 10010;

int ma[maxn];

int main() {
	int n;
	while (cin>>n){
		for (int i = 0; i < n; i++) {
			cin >> ma[i];
		}
		sort(ma, ma + n);
		cout << ma[n - 1] << " " << ma[0] << endl;
	}
	return 0;
}

  

原文地址:https://www.cnblogs.com/songlinxuan/p/12394783.html

时间: 2024-08-30 15:01:42

清华大学机试 最大最小值 Easy的相关文章

清华大学机试 反向输出 Easy

基本思想: 无: 关键点: 无: #include<iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> #include<set> using namespace std; int main() { string s; while (cin >> s) { for (int i = s.size() - 1; i &

清华大学机试 特殊乘法 Easy

基本思想: 无: 关键点: 无: #include<iostream> #include<vector> #include<string> using namespace std; int charge(string a, string b) { int cnt=0; for (int i = 0; i < a.size(); i++) { for (int j = 0; j < b.size(); j++) { cnt += int(a[i] - '0')

清华大学机试 球的半径和体积 Easy

基本思路: 无: 关键点: 无: #include<iostream> #include<vector> #include<algorithm> #include<string> #include<cmath> #include<set> #include<map> using namespace std; int main() { double x0, y0, z0; double x1, y1, z1; while (

清华大学机试 剩下的树 Easy *贪心的区间思想

基本思想: 自己想到了贪心区间里面进行区间排序的思想: 但是还有一种更简单的,直接进行构建一个标记数组,然后按个数进行标记即可: 关键点: 注意区间包含问题: #include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; struct n

华中尔科技大机试 二叉树遍历 Easy *两序列构建二叉树

基本思想: 要求用两个序列构建新的二叉树,标准写法,注意下: 关键点: 无: #include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> #include<vector> #include<algorithm> #include<map> #include<set> using namespace std; string s1

浙江大学机试 畅通工程 Easy

基本思想: 无: 关键点: 无: #include<iostream> #include<string> #include<vector> #include<map> using namespace std; const int maxn = 1020; int father[maxn]; int m, n; bool ma[maxn][maxn]; void init(int n) { for (int i = 0; i <= n; i++) fat

清华大学软件2014机试

清华大学软件2014机试 By 钟桓 9月 24 2014 更新日期:9月 24 2014 今天刚刚机试完,乘者还没忘记,把自己知道的记下来,也算是泽被后来人吧~~~ 这次的机试题,相对来说,会更简单一点,总共3题,时间是3小时. 1 超级幸运数 题目大致描述: 一个数字,若是只含有1和4,这个数字就是幸运数,例如,14,114.但是514这样的就不是了,因为含有其它数字. 若这个幸运数字中,1和4的数量相同,那么就是超级幸运数,例如14,1144,41等等. 题目要求,输入一个n,n的范围是[

清华大学软件2016机试

机试完几天了,两个月的准备就是为了这三小时的三道题,趁着没忘记,把题目贡献出来,也算是继承学长的光荣传统,泽被后人吧! 1.大数乘法 先输入一个数字m,表示后面将输入m个数,接着输入m个0到9的数,以空格隔开(至少有一个不为0),这些数可构成一个十进制数a, a的三次方为数b, 求b的各个位的数字,输出时以空格隔开,不要输出多余的空格. 输入示例: 4 1 2 3 4 输出示例: 1 8 7 9 0 8 0 9 0 4 思路:题目不难,用大数乘法做之  2.最短时间 给一个有向图,图的各个顶点的

华为校招机试—传送门

华为机试-多个数的最大公约数 华为机试-算日期 华为机试-拼音翻译成阿拉伯数字(只有数字拼音) 华为机试-拼音翻译成阿拉伯数字(有Wan,Qian,Bai,Shi单位) 华为机试-输出大写字母 华为机试-亮着电灯的盏数(优化过的双重for) 华为机试-从考试成绩中划出及格线 华为机试-亮着电灯的盏数(1-N完全平方数的个数) 华为机试-大数相减 华为机试-姓名的夫妻相 华为机试-元素按奇偶排序 (金字塔) 华为机试-地铁换乘(图文吐血整理) 华为机试-"十七进制"转"十进制&