Run ID:103251

提交时间:2024-12-28 15:09:58

#include<iostream> #include<cstring> using namespace std; int main(){ //strlen(x)长度 //strcpy(s1,s2)复制 //strcat(str1,str2)str1+str2 123 456 123456 拼接 //strcmp(str1,str2)str1>str2 1 str1=str2 0 str1<str2 -1 比较 /** int t1,k,n1,b,t2,n2; cin>>t1>>k; for(int i=0;i<k;i++){ cin>>n1>>b>>t2>>n2; if(t2<=t1){ if((n1<n2 && b==1) || (n1>n2 && b==0)){ t1=t1+t2; cout<<"Win "<<t2<<"! Total="<<t1; } else if((n1<n2 && b==0) || (n1>n2 && b==1)){ t1=t1-t2; cout<<"Lose "<<t2<<".Total="<<t1; } if(t1==0){ cout<<"Game Over"; return 0; } } else cout<<"Not enough tokens.Total="<<t1; } char a[1001],x=0; int i=0,b[127],max=0; cin.getline(a,1000); while(a[i]!='/0'){ i++; b[a[i]]++; } for(char i=97;i<=123;i++){ if(max<b[i]){ max=b[i]; x=i; } } cout<<max<<x; **/ int max,i=0,n; char str[1000000]; cin>>str; n=strlen(str); max=str[0]-'0'; for(int i=0;i<n;i++){ if(max<=str[i]-'0'){ max=str[i]-'0'; } } cout<<max<<" "; return 0; }