Files
python/LuoGu/RuMen/P1897.cpp
HuangHai 1f397eca87 'commit'
2025-08-30 18:35:01 +08:00

33 lines
955 B
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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;
}