[SGU]114. Telecasting station
来源:互联网 发布:美工助理面试自我介绍 编辑:程序博客网 时间:2024/05/22 00:09
Analysis
这题寻找一个在最中间的citizen输出位置就可以了,证明略(很简单的……)
Accepted Code
var n,i,k,sump:longint; x,p:array[1..15000] of longint;procedure sort(l,r:longint);var i,j,mid,tmp:longint;begin mid:=x[(l+r) shr 1]; i:=l; j:=r; repeat while x[i]<mid do inc(i); while x[j]>mid do dec(j); if not (i>j) then begin tmp:=x[i]; x[i]:=x[j]; x[j]:=tmp; tmp:=p[i]; p[i]:=p[j]; p[j]:=tmp; inc(i); dec(j); end; until i>j; if i<r then sort(i,r); if l<j then sort(l,j);end;begin read(n); sump:=0; for i:=1 to n do begin read(x[i],p[i]); sump:=sump+p[i]; end; sort(1,n); i:=1; k:=0; while k<=sump shr 1 do begin inc(k,p[i]); inc(i); end; i:=i-1; writeln(x[i],'.00000');end.
- [SGU]114. Telecasting station
- 【SGU】 114. Telecasting station 中位数
- sgu 114 Telecasting station
- Sgu 114 Telecasting station
- [sgu]Telecasting station【三分】
- SGU 114 Telecasting station
- SGU 114 Telecasting station
- SGU 114 Telecasting station
- SGU 114. Telecasting station 三分or找中位数
- 114. Telecasting station
- SGU 114 Telecasting station 单峰极值函数
- SGU 114 Telecasting station(水~)
- SGU 114 Telecasting station(二分)
- SGU114 Telecasting station 三分
- SGU114-Telecasting station
- sgu114 Telecasting station 三分
- sgu114:Telecasting station
- SGI114 Telecasting station
- 队列学习
- Java中连接各种数据库
- 关于大公司和小公司的选择
- android.net.ConnectivityManager
- 字符串编码之间的转换(GB2312<->UTF8<->Unicode)及URLEncoding
- [SGU]114. Telecasting station
- 基本导入和导出excel
- DBCP 应用的总结(一)
- 水晶报表10 打印、导出按钮不能用
- 利息计算器
- 转载:C++输出格式控制
- 通过书中的一个小例子来了解一下简单的python基础
- VS2010中安装asp.net mvc3.0出错解决办法
- C++ 四则运算表达式(简单的+-*/带括号) 栈