跳到正文

题解

题解:P2459 [SDOI2007] 立体分割

zhangzirui66约 1 分钟
原文
文章信息与版本

文章信息

收录
2025年12月12日
更新
2025年12月12日
篇幅
约 1 分钟
获赞
1
题目
P2459

版本

  1. v1当前

考虑一种十分离谱的做法。

我们并没有必要研究复杂的切法,考虑很朴素的东西,先讲个故事。

Story Time

我有一块蛋糕: 邻居家捣蛋鬼小孩给我切成了 nn 块: 但他有强迫症: 他就帮我们做好了。

分析

熊孩子说了,横着平均切就行了,所以:

Coding Time

C++
#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;
}
原文