ACM模版

描述

题解

话说这道题,代码极其简单,规律也很简单,如果一下子就看出来规律,那么这道题就水得不能再水了,如果一下子看不出来,那只要推两个样例就行了……
说白了,res就等于最大的数位值……

代码

#include <iostream>

using namespace std;

int main(int argc, const char * argv[])
{
    int n;

    int res = 0;
    while (cin >> n)
    {
        res = 0;
        while (n)
        {
            res = n % 10 > res ? n % 10 : res;
            n /= 10;
        }
    }

    std::cout << res << '\n';
    return 0;
}