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)(1≤W,S≤104). 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)(1≤X,Y≤100).
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 )(0≤si≤Y) 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)