题解:P2459 [SDOI2007] 立体分割
考虑一种十分离谱的做法。
我们并没有必要研究复杂的切法,考虑很朴素的东西,先讲个故事。
Story Time
我有一块蛋糕:
邻居家捣蛋鬼小孩给我切成了 块:
但他有强迫症:
他就帮我们做好了。
分析
熊孩子说了,横着平均切就行了,所以:
Coding Time
#include<bits/stdc++.h>
using namespace std;
int x, y, z, n;
int main(){
cin >> x >> y >> z >> n;
double h = 1.0 * z / n;
int cnt = 0;//切到第几块
for(int i = 1; i <= n; i ++){
cout << 0 << " " << 0 << " ";
printf("%.10lf ", h * cnt);//上次切到这了
cout << x << " " << y << " ";
printf("%.10lf", h * (++ cnt));
cout << "\n";
}
return 0;
}
posted on 2024-11-29 18:37 zhangzirui66 阅读(17) 评论(0) 收藏 举报 来源