摘要:
题意:给出一些圆盘,质量和面积成正比,把他们一层一层的按照规定的坐标罗起来,问到哪一层会不稳定。不稳定的意思就是说中间存在某一个圆盘,它上面的所有圆盘的质心在它的面积范围之外。题目对输出中的哪一层的k描述有误,实际输出的层号比题中描述的小1。分析:利用质心公式X=(X1*M1+X2*M2+ ... ... +Xn*Mn)/(M1+M2+ ... ... +Mn) ,Y=(Y1*M1+Y2*M2+......+Yn*Mn)/(M1+M2+......+Mn)用n^2的效率判断即可。View Code #include <iostream>#include <cstdlib> 阅读全文
posted @ 2012-11-02 19:53
undefined2024
阅读(234)
评论(0)
推荐(0)
摘要:
模拟,注意Justify模式的最后一行,无论有几个单词都要用Left方式输出。View Code #include <iostream>#include <cstdlib>#include <cstdio>#include <cstring>using namespace std;#define maxn 505#define maxl 80#define max_len 75char word[maxn][maxl];char cmd[3];int n;int sum[maxn];int word_len[maxn];void input(){ 阅读全文
posted @ 2012-11-02 10:52
undefined2024
阅读(165)
评论(0)
推荐(0)

浙公网安备 33010602011771号