题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2014 题目大意:给你 n 个数,去掉 max 和 min ,求平均数 解题思路: 很水,边记录分数,边记录最边值 代码: #include<iostream> #include<cmath> #include<iomanip> #include<algorithm> using namespace std; int num; int main() { int n…
题意:就是给你 n 个数,代表n个星球的位置,每一个星球的重量都为 1 ! 开始的时候每一个星球都绕着质心转动,那么质心的位置就是所有的星球的位置之和 / 星球的个数 现在让你移动 k 个星球到任意位置(多个星球可以在同一个位置并且所有的星球在同一直线上) 移动之后那么它们质心的位置就可能发生变化,求 I = sum(di^2) di (表示第i个星球到达质心的距离)最小! 设d为n-k个星球的质心位置,如果I值最小,那么移动的k个星球一定都放在另外n-k个星球的质心上, 并且这n-k个星球一定…
Problem Description Noting is more interesting than rotation! Your little sister likes to rotate things. To put it easier to analyze, your sister makes n rotations. In the i-th time, she makes everything in the plane rotate counter-clockwisely around…
/* 注意两点 1.从后往前找互补的,刚开始我找的是相邻的但是这个例子就不行101 110 2.因为时累加所以sum可能会超出int范围,这个很重要. */ #include<stdio.h> #define N 110000 #include<string.h> int a[N]; int vis[N]; int power(int u) { int k=0; while(u) { u/=2; k++; } return k; } int main() { int n,i,aa,…
http://acm.hdu.edu.cn/showproblem.php?pid=5071 Chat Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 702 Accepted Submission(s): 163 Problem Description As everyone knows, DRD has no girlfr…
HDU 5073 Galaxy (2014 Anshan D简单数学) 题目链接http://acm.hdu.edu.cn/showproblem.php?pid=5073 Description Good news for us: to release the financial pressure, the government started selling galaxies and we can buy them from now on! The first one who bought…