/** * The Secret Number (PKU 2030) * by Kenji Inoue, 2007-01-02 **/ #include #include using namespace std; #define isdigit(x) ('0' <= (x) && (x) <= '9') char f[71][71]; // field string t[71][71]; // table int w, h; string max(string s1, string s2) { if (s1.size() > s2.size()) { return s1; } else if (s1.size() < s2.size()) { return s2; } if (s1 > s2) { return s1; } return s2; } string rec(int x, int y) { if (x < 0 || y < 0) { return ""; } if (!isdigit(f[y][x])) { return ""; } if (t[y][x] != "-") { return t[y][x]; } t[y][x] = max(rec(x, y-1), rec(x-1, y)) + f[y][x]; if (t[y][x] == "0") { t[y][x] = ""; } return t[y][x]; } int main() { while (cin >> w >> h, (w || h)) { for (int y=0; y> f[y]; for (int x=0; x