You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
923 B

2 years ago
#include <bits/stdc++.h>
using namespace std;
int f = 0, maxf = 0, n; //n统计要下的人数f统计要下的层数
map<int, bool> fp;
int j;
int main() {
ios::sync_with_stdio(false); //读入输出优化的强迫症
//初始化
fp.clear();
//键盘读取n
cin >> n;
//循环读取n个人员的数据
for (int i = 0; i < n; i++) {
cin >> j;
//如果此楼层出现过,或者是零层,那么继续下一个
if (fp[j] || j == 0) continue;
//计算最高的层数
if (j > maxf) maxf = j;
// 标识此层需要开门
fp[j] = true;
//开门次数
f++;
}
//输出结果 n:代理n个人每人下电梯需要1秋计n秒。
// 上一层6秒下一层4秒就是说一层需要的总时长10秒计10*maxf
// f:开一次门需要5秒计f*5
cout << n + f * 5 + 10 * maxf;
return 0;
}