BZOJ1753: [Usaco2005 qua]Who's in the Middle

问n<=10000个点的中位数。

水题必有玄机!(然后浪费了半天在怎么O(n)求中位数并且最后放弃了)

 1 #include<stdio.h>
 2 #include<string.h>
 3 #include<algorithm>
 4 #include<cstdlib>
 5 //#include<iostream>
 6 using namespace std;
 7
 8 int n;
 9 #define maxn 10011
10 int a[maxn];
11 int main()
12 {
13     scanf("%d",&n);
14     for (int i=1;i<=n;i++) scanf("%d",&a[i]);
15     sort(a+1,a+1+n);
16     printf("%d\n",a[(n+1)/2]);
17     return 0;
18 }

BZOJ1753: [Usaco2005 qua]Who's in the Middle

时间: 2024-08-01 04:41:11

BZOJ1753: [Usaco2005 qua]Who's in the Middle的相关文章

bzoj1754[Usaco2005 qua]Bull Math*

bzoj1754[Usaco2005 qua]Bull Math 题意: 求两个正整数的积,每个数≤40位. 题解: 为什么C++不能支持高精度呢…… 代码: 1 a=int(raw_input()) 2 b=int(raw_input()) 3 print a*b 20160831

1751: [Usaco2005 qua]Lake Counting

1751: [Usaco2005 qua]Lake Counting Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 190  Solved: 150[Submit][Status][Discuss] Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle

[BZOJ1755] [Usaco2005 qua] Bank Interest

Description Farmer John made a profit last year! He would like to invest it well but wonders how much money he will make. He knows the interest rate R (an integer between 0 and 20) that is compounded annually at his bank. He has an integer amount of

BZOJ 1754: [Usaco2005 qua]Bull Math

Description Bulls are so much better at math than the cows. They can multiply huge integers together and get perfectly precise answers ... or so they say. Farmer John wonders if their answers are correct. Help him check the bulls' answers. Read in tw

【BZOJ】1754: [Usaco2005 qua]Bull Math

[算法]高精度乘法 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int maxn=100; char s1[maxn],s2[maxn]; int a[maxn],b[maxn],c[maxn],lena,lenb,lenc; int main(){ scanf("%s%s",s1,s2); lena=strlen(s1);lenb

bzoj 1754: [Usaco2005 qua]Bull Math【高精乘法】

高精乘法板子 然而WA了两次也是没救了 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=105; int la,lb,lc,a[N],b[N],c[N],tot; char ch[N]; int main() { scanf("%s",ch+1); la=strlen(ch+1); for(int i=1;i<=la;i

bzoj 1755: [Usaco2005 qua]Bank Interest【模拟】

原来强行转int可以避免四舍五入啊 #include<iostream> #include<cstdio> using namespace std; int r,y; double m; int main() { scanf("%d%lf%d",&r,&m,&y); double l=1.0+(double)r/100.0; for(int i=1;i<=y;i++) m*=l; printf("%d\n",(i

大神刷题表

9月27日 后缀数组:[wikioi3160]最长公共子串 dp:NOIP2001统计单词个数 后缀自动机:[spoj1812]Longest Common Substring II [wikioi3160]最长公共子串 [spoj7258]Lexicographical Substring Search 扫描线+set:[poj2932]Coneology 扫描线+set+树上删边游戏:[FJOI2013]圆形游戏 结论:[bzoj3706][FJ2014集训]反色刷 最小环:[poj1734

bzoj usaco 金组水题题解(1)

UPD:我真不是想骗访问量TAT..一开始没注意总长度写着写着网页崩了王仓(其实中午的时候就时常开始卡了= =)....损失了2h(幸好长一点的都单独开了一篇)....吓得赶紧分成两坨....TAT.............. —————————————————————————————————————————————————————————————————————————————— 写(被虐)了整整一个月b站上usaco的金组题...然而到现在总共只写了100道上下TAT(当然是按AC人数降序排