判断奇偶

#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int N=1e6+11;
char s[N];
int main(){
    gets(s);
    int n=strlen(s);
    if(s[n-1]&1)//奇数 
        puts("-1");
    else//偶数 
        puts("1");
    return 0; 
}

猜你喜欢

转载自blog.csdn.net/aaakkk_1996/article/details/82193950