top1编程
← 返回题目
题解

【入门】最大的偶数字符

1 条题解

  • 0
    @ 2026-7-29 1:48:43
    #include<bits/stdc++.h>
    using namespace std;
    string s;
    char maxx='0'; 
    int main(){
    	cin>>s;
    	for(int i=0;i<s.size();i++){
    		if(int (s[i])%2==0&&int (s[i])>int(maxx)){
    			maxx=s[i];
    		}
    	}
    	if(maxx=='0'){
    		cout<<"No";
    	}
    	else{
    		cout<<maxx;
    	}
        return 0;
    }
    
    • 1