记录编号 |
421612 |
评测结果 |
A |
题目名称 |
排队接水 |
最终得分 |
100 |
用户昵称 |
HeHe |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.000 s |
提交时间 |
2017-07-07 16:03:47 |
内存使用 |
1.58 MiB |
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
namespace IO{
inline char getc(void);
inline int in(void);
inline void write(int x);
inline void write(void);
inline void write_all(void);
char ops[1 << 18], *opt = ops, *const opt_end = ops + (1 << 18);
inline char getc(void) {
static char buf[1 << 18], *fs, *ft;
return (fs == ft && (ft = (fs = buf) + fread(buf, 1, 1 << 18, stdin)), fs == ft) ? EOF : *fs++;
}
inline int in(void) {
register int res = 0;
register char tmp = getc();
while(!isdigit(tmp)) tmp = getc();
while(isdigit(tmp))
res = ((res + (res << 2)) << 1) + (tmp ^ 48),
tmp = getc();
return res;
}
inline void write(int x){
char *p = new char[20]();
do{
*(++p) = (x % 10) | 0x30;
x /= 10;
}while(x);
while(*p) {
*(opt++) = *(p--);
if(opt == opt_end) write_all();
}
*(opt++) = ' ';
if(opt == opt_end) write_all();
return ;
}
inline void write(void) {
*(opt++) = '\n';
if(opt == opt_end) write_all();
return ;
}
inline void write_all(void) {
fwrite(ops, 1, opt - ops, stdout);
opt = ops; return ;
}
}
using namespace IO;
const int MAXN = 1e5 + 10;
const bool cmp(const int a, const int b);
int N, T[MAXN];
int id[MAXN];
int pre, tot;
int main() {
#ifndef LOCAL
freopen("jieshui.in", "r", stdin);
freopen("jieshui.out", "w", stdout);
#endif
N = in();
for(int i = 1; i <= N; ++i) {
T[i] = in();
id[i] = i;
}
sort(id + 1, id + 1 + N, cmp);
for(int i = 1; i <= N; ++i) {
write(id[i]);
tot += pre;
pre += T[id[i]];
}
write();
write_all();
printf("%.2lf", (double)tot/(double)N);
return 0;
}
const bool cmp(const int a, const int b) {
return T[a] < T[b];
}