Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
145467 杨登博 22数字最多的字符串 C++ Compile Error 0 MS 0 KB 806 2026-01-25 15:38:08

Tests(0/0):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ char a[1001],b[1001]; int la=strlen(a),lb=strlen(b),n,na=0,nb=0,s1=0,s2=0; cin>>a>>b; for(int i=1;i<=strlen(a);i++){ if(a[i]>="0"&&a[i]<=9){ s1++; } } for(int i=1;i<=strlen(a);i++){ if(b[i]>="0"&&b[i]<=9){ s2++; } } if(s>n){ for(int i=la-1;i<=1;i++){ cout<<b[i]; } cout<<a[i]; } else{ for(int i=la-1;i<=1;i++){ cout<<b[i]; } cout<<a[i-1]; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:11:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;i<=strlen(a);i++){
                  ^
Main.cc:12:18: warning: comparison with string literal results in unspecified behaviour [-Waddress]
         if(a[i]>="0"&&a[i]<=9){
                  ^
Main.cc:12:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:16:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=1;i<=strlen(a);i++){
                  ^
Main.cc:17:18: warning: comparison with string literal results in unspecified behaviour [-Waddress]
         if(b[i]>="0"&&b[i]<=9){
                  ^
Main.cc:17:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
Main.cc:21:8: error: 's' was not declared in this scope
     if(s>n){
        ^
Main.cc:25:17: error: 'i' was not declared in this scope
         cout<