U214250错在哪里

题目总版

mao13588607991 @ 2024-10-30 16:47:12

  1. #include<bits/stdc++.h>
    using namespace std;
    char a[30000000];
    int main(){
    long long n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=n;i++)
    {
        int len=strlen(a[i])
        if(len%2==0) cout<<"even"<<endl;
        else cout<<"odd"<<endl;
    }
    return 0;
    }

by q_hacker_p @ 2024-10-30 16:48:47

???


by Mr_yang1 @ 2024-10-30 17:01:53

@mao13588607991

#include<bits/stdc++.h>
using namespace std;
int n;
string x; 
int main(){
    cin>>n;
    while(n--){
        cin>>x;
        char a=x[x.length()-1];
        if(a=='1'||a=='3'||a=='5'||a=='7'||a=='9')cout<<"odd"<<endl;
        else cout<<"even"<<<endl;
    }
}

ac代码,求关注


by Mr_yang1 @ 2024-10-30 17:19:02

@mao13588607991


by jinhaoxuan001 @ 2024-11-01 19:18:26

#include<bits/stdc++.h> 
using namespace std; 
int a[30000000]; 
int main(){ 
    long long n; 
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    } 
    for(int i=1;i<=n;i++){ 
        if(a[i]%2==0){
            cout<<"even"<<endl; 
        } 
        else {
            cout<<"odd"<<endl;  
        }
    } 
    return 0; 
}

|