Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
124979 | 刘轻松 | 字符串中最大的数字 | C++ | Accepted | 0 MS | 272 KB | 262 | 2025-07-13 09:26:45 |
#include<iostream> #include<cstring> using namespace std; int main(){ long long n; cin>>n; int max=0; if(n<0){ //如果是负数 n = -1*n; //变成正数 } while(n>0){ if(max<n%10){ max = n%10; } n = n/10; } cout<<max; }