51nod 1413 权势二进制 【思维题】

来源:互联网 发布:惠州市博罗县网络问政 编辑:程序博客网 时间:2024/06/05 06:05

不作多解释 只需要找到该数每一位 的最大数即可

#include<iostream>#include<algorithm>using namespace std;int main(){    int n;    cin>>n;    int maxx=-1;    while(n){        maxx=max(maxx,n%10);        n/=10;    }    cout<<maxx<<endl;    return 0;}
原创粉丝点击