题目大意:输入奶牛个数、各奶牛的产奶量。输出产奶量的中间的那个解题思路:1)先排序,然后去中间哪一个即可代码如下:/* * 1157_1.cpp * * Created on: 2013年8月10日 * Author: Administrator */#include using namespace std;int main(){ in
原创
2013-08-14 17:42:46
10阅读
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int main(){ int i,j,k,f,v,t,a[100][100],dp[100][100]; scanf("%d%d",&f,&v); ...
转载
2021-08-13 20:06:00
159阅读
2评论
2011-12-16 11:13:43地址:http://acm.hdu.edu.cn/showproblem.php?pid=1157题意:给n个数字(n是奇数)找中位数。mark:wa了一次,被题目坑了。他是多组数据输入的。。。代码:# include <stdio.h># include <stdlib.h>int a[10010] ;int cmp(const void *a, const void *b){ return *(int*)a - *(int*)b ;}int main (){ int i, n ; while (~scanf ("%d&
转载
2012-01-06 17:31:00
22阅读
SegmentsTime Limit: 2000msMemory Limit: 10000KBThis problem will be judged onACdream. Original ID:115764-bit integer IO format:%lld Java class name:(N...
转载
2015-08-14 15:30:00
59阅读
快速排序的水题,,用sort应该也可以,用来练习快速排序了。。题目:
Who's in the Middle
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4266 Accepted Submission(s):
转载
2012-03-27 09:06:00
90阅读
2评论
1157 Anniversary(25 分)Zhejiang University is about to celebrate her 122th anniversary in 2019. To prepare f
原创
2022-09-15 10:52:47
56阅读
Reachable NumbersCodeForces - 1157A 题意:给出x问多少y可以有f(x)得到。就是不断f(f(f(f(x))))。注意x去零还有为0的情况,用map以及遇到已经访问过的直接结束。#include<iostream>#include<cstdio>#include<cstring>#include<...
原创
2022-08-22 17:45:25
111阅读
/* 题意: 有n束花和m个花瓶,一束花 i 插在一个花瓶 j 中都有一个对应的美观值 A[i][j], 现在要将这n束花全部插入花瓶中并使得所有的花的美观值最大,求该最大值. 题目规定若i<j,则第i束花必须出现在第j束花之前, 设 ans[i,j] 为前 i 束花插在前 j 个花瓶中的最大美学值, 则有状态转移方程:ans[i,j]=max(ans[i-1,k-1]+A[i,k]),其中i<=k<=j, A[i,k] 为第 i 束花插在第 k 个花瓶中的美学值,规定ans[0,j]=0,0<=j<=m*/#include <iostream> //
转载
2011-07-22 19:02:00
88阅读
2评论
据说是经典dp问题? 对于每个a[i][j],表示第 i 种花放在第 j 个花瓶里时产生的美学价值(aesthetic value), 我们用dp[i][j]表示共 i 种花放到 j 个花瓶里,产生的最大美学价值(显然这需要i<=j)。 那么我们的答案也很简单,就是dp[F][V]。 那么接下来就是
转载
2017-07-26 22:02:00
91阅读
2评论
#include #include using namespace std;int main(){ int n; while(scanf("%d",&n)!=EOF) { int a[100000]; for(int i=0; i<n; i++) scanf("%d",&a[i]); sort(a,a+n); printf("%d\n",a[n/2]); } return 0;}
转载
2013-12-25 16:40:00
104阅读
Problem Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this ‘median’ cow gives: half of the cows give as much or more than the median; half give as m
原创
2022-05-14 11:06:23
38阅读
Long NumberCodeForces - 1157B 题意:英语是硬伤。错了好多次,多错了题意。可以从数字串的某一个位置开始替换一段字串f(xi),不能超过一次。输出答案。You can perform the following operation no more than once: choose a non-empty contiguous subsegment of di...
原创
2022-08-22 17:45:11
94阅读
Who's in the MiddleTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20228 Accepted Submission(s): 8883Problem DescriptionFJ is sur
原创
2023-02-20 10:20:58
31阅读
[POJ1157]LITTLE SHOP OF FLOWERS 试题描述 You want to arrange the window of your flower shop in a most pleasant way. You have F bunches of flowers, each be
转载
2016-08-24 16:22:00
102阅读
2评论
/*F - 简单dpTime Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionYou want to arrange the window of your f...
转载
2015-07-10 17:45:00
45阅读
2评论
Minimum ArrayCodeForces - 1157E 题意 :给出a,b两个数组,每个数组都有n个数(0<=ai,bi<=n-1),b数组里面的数可以任意交换位
原创
2022-08-22 17:45:05
35阅读
LITTLE SHOP OF FLOWERSTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 18481 Accepted: 8512DescriptionYou want to arrange the window of your flower shop in
原创
2023-04-24 08:35:48
53阅读
题意: 给定一个矩阵,在每一排中选 一个数,相加之和为最大eopen
原创
2023-07-27 18:47:42
18阅读
#include<bits/stdc++.h> using namespace std; const long long maxn=1e7+9; typedef long long ll; ll n,k,a[maxn],b[maxn]; void dfs(ll level) { if(level==
原创
2021-05-24 11:55:47
911阅读
ans=max(ans,dp[n][i]);
转载
2017-08-13 17:46:00
126阅读
2评论