POJ1009?

来源:百度知道 编辑:UC知道 时间:2024/06/05 10:31:54
过了的给个思路,再附个代码?谢谢啊

#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
const int MAXRUNS = 1000;
// input data
long imageWidth;
long runLength[MAXRUNS + 2]; // runs with dummy border runs at ends
int pixVal[MAXRUNS + 2]; // pixel values in runs.
int lastRunIndex; // excluding final added border
// dummy border runs at indices 0 and lastRunIndex+1 are added
// data for position in grid
// maintain positions in image of a pixel in the previous, current,
// and next row with indices 0, 1, and 2 respectively in each array
// runIndex and leftInRun
// where an entry i in runIndex is used to reference the run given by
// runLength[i] and pixVal[i] and the entries in leftInRun are the number
// of pixels after the current pixel in its run.
// Pixels may be in the dummy run before or after the image.
// The pixel in the center row is in the cente