German Collegiate Programming Contest 2015: I. Milling machines

本文探讨了在Fab Lab中使用CNC铣削机进行工作件加工的情况。给定一个包含多个工作件和铣削步骤的程序,需要模拟每个工作件经过相同铣削步骤后的表面剩余高度。输入包括工作件数量、步骤数、工作件尺寸及每个步骤的切割深度,输出是每个工作件处理后的表面高度。
摘要由CSDN通过智能技术生成

A fab lab is an open, small-scale workshop where you can create or fabricate almost anything you want mostly by using computer controlled tools like a laser cutter or a 3D printer. The FAU fab lab recently got a CNC milling machine. Using the milling machine you can cut or remove material with different tools from the surface of a workpiece. It is controlled via a computer program.

I sometimes wondered what happens if multiple different shaped workpieces are sent through the same milling program. For simplification assume that we have only two dimensional workpieces without holes. A milling program consists of multiple steps; each step describes where the milling machine has to remove material (using different tools) from the top of the surface.

Input Format

The first line consists of two integers WW and SS, where WW gives the number of workpieces and SS the number of steps in the milling program (1 \le W, S \le 10^4)(1W,S104). The next line consists of two integers XX and YY , where XXgives the width and YY gives the maximal possible height of workpieces (1 \le X, Y \le 100)(1X,Y100).

Then follow WW lines, each describing one workpiece. Each workpiece description consists of XX non-negative integers specifying the surface height in that column.

Then follow SS lines, each describing one milling step of the milling progam. Each milling step description consists of XX non-negative integers si (0 \le s_i \le Y )(0siY) specifying the amount of surface to cut off in each column (relative to the height of the milling area, i.e. YY , not relative to the top of the workpiece). See Fig. I.11 for details.

Output Format

For each workpiece, output one line containing XX integers specifying the remaining surface heights (in the same order as in the input).

样例输入1
2 1
3 4
4 4 4
4 2 3
2 3 0
样例输出1
2 1 4
2 1 3
样例输入2
1 3
10 100
11 22 33 44 55 66 77 88 99 100
1 100 1 100 1 100 1 100 1 100
58 58 58 58 58 58 58 58 58 58
42 42 42 42 42 42 42 42 66 42
样例输出2
11 0 33 0 42 0 42 0 34 0

emmmmmmmm。。。。

这题具体让干啥的我给忘了,反正记得是模拟题

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<queue> 
#include<stdlib.h>
#include<cmath>
using namespace std;  
int main(){
	int w,s;
	cin>>w>>s;
	int x,y;
	cin>>x>>y;
	static int a[10004][120];
	for(int i=0;i<w;i++){
		for(int j=0;j<x;j++){
			scanf("%d",&a[i][j]);
		}
	}
	int maxn[200]={0};
	for(int i=0;i<s;i++){
		for(int j=0;j<x;j++){
			int num;
			scanf("%d",&num);
			if(num>maxn[j]) maxn[j]=num;
		}
	}
	//for(int j=0;j<x;j++){
		//printf("%d ",maxn[j]);
//	}
	for(int i=0;i<w;i++){
		for(int j=0;j<x;j++){
			int fz=y-maxn[j];
			a[i][j]=min(a[i][j],fz);
		}
	}
	for(int i=0;i<w;i++){
		for(int j=0;j<x;j++){
			if(j==0) printf("%d",a[i][j]);
			else printf(" %d",a[i][j]);
		}
		printf("\n");
	}
	return 0;
}

欢迎大家加入 早起学习群,一起学习一起进步!(群号:642179511)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值