首页 > 试题广场 >

单组_spj判断YES与NO

[编程题]单组_spj判断YES与NO
  • 热度指数:5060 时间限制:C/C++ 3秒,其他语言6秒 空间限制:C/C++ 256M,其他语言512M
  • 算法知识视频讲解
给定一个正整数 n
如果 n 是奇数,输出 YES
如果 n 是偶数,输出 NO
你可以输出任意大小写形式的 YESNO
比如, yes , Yes , yEs 都会被视为 YES

输入描述:
第一行有一个整数 n\ (\ 1 \leq n \leq 10^9\ )


输出描述:
如果 n 是奇数,输出 YES
如果 n 是偶数,输出 NO
示例1

输入

123

输出

YES
示例2

输入

124

输出

no
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int number = in.nextInt();
        System.out.println(number%2==0 ? "NO" : "YES");
    }
}

发表于 2025-04-24 11:20:06 回复(0)
        int n = in.nextInt();
        String r = "";
        if(n%2==0){
            r="no";
        }else if(n%2!=0){
            r="YES";
        }
        System.out.println(r);

发表于 2025-04-19 11:02:42 回复(0)
t = int(input())
if t%2 == 1:
    print("YES")
else:
    print("NO")
发表于 2025-03-20 10:13:49 回复(0)
此题考查基础,属于基础题。
#include<stdio.h>
int  main(void)
{
    long  long  n;
    scanf("%lld",&n);
    if (n%2!=0)
    {
        printf("YES");
    }
    else
    {
        printf("No");
    }
    return  0;
}
发表于 2025-02-25 20:00:21 回复(0)
#include <iostream>
using namespace std;

int main() {
    int a;
    cin >>a;
    if(a%2 ==0)
    {
        printf("NO");
    }else {
         printf("YES");
    }
}
发表于 2025-02-12 16:45:02 回复(0)
System.out.println((new Scanner(System.in).nextInt() & 1) == 0 ? "NO" : "YES");

发表于 2025-01-18 16:57:16 回复(0)
print('YES' if int(input()) % 2 == 1 else 'NO')

发表于 2024-12-04 12:24:26 回复(0)
n = int(input())

if n%2 != 0:
    print('YES')
else:
    print('NO')
发表于 2024-11-23 01:28:50 回复(0)
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        //余数wei,则n为正整数
        if (n % 2 == 0) {
            System.out.println("NO");
        }else {
            System.out.println("YES");
        }
    }
}
发表于 2024-09-27 17:40:16 回复(0)
print('yes' if int(input()) & 1 else 'no')
发表于 2024-09-24 16:48:54 回复(0)
a = int(input())
if a % 2 == 1:
    print("yes")
else:
    print("no")
发表于 2024-09-09 00:05:39 回复(0)