Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
100130 郝王骏程 字符串中最大的数字II C++ Accepted 1 MS 276 KB 367 2024-12-02 21:55:39

Tests(10/10):


Code:

#include <iostream> #include <string> #include <algorithm> using namespace std; int main(){ string n; cin >> n; int s = n[0] == '-' ? 1 : 0; char m = '0'; for (int i = s; i < n.length(); i++) { if (n[i] >= '0' && n[i] <= '9') { m = max(m, n[i]); } } cout << m << endl; return 0; }