1 条题解

  • 0
    @ 2026-2-10 15:53:22

    C :

    #include<stdio.h>
    int main()
     {
     	int a,b;
     	scanf("%d%d",&a,&b);
     	if(a<=6&&b<=2||a<=20&&b<5)
     	{
     		printf("yes\n");
    	 }
    	else
    	 {
    	 	printf("no\n");	
    	 }
     }
    

    C++ :

    #include<stdio.h>
    int main()
    {
        int a,b;
        scanf("%d%d",&a,&b);
        if(a<=6)
        printf("yes");
        else if(b<=2)
        printf("yes");
        else if(a<=20&&b<5)
        printf("yes");
        else
        printf("no");
        return 0;
    }
    

    Java :

    import java.util.Scanner;
    
    public class Main {
        public static void main(String[] args){
            Scanner scanner = new Scanner(System.in);
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            if (((a <= 6)||(b <= 2))||((a <= 20)&&(b < 5))) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
        }
    }
    

    Python :

    # coding=utf-8
    #!/usr/bin/python2
    import sys
    import re
    import math
    a,b=(int(x) for x in raw_input().split(' '))
    
    if a<=6 or b<=2:
        print "yes"
    else:
        if a<=20 and b<5:
            print "yes"
        else:
            print "no"
    

    C# :

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.Remoting.Channels;
    using System.Runtime.Remoting.Metadata.W3cXsd2001;
    using System.Security.Cryptography;
    using System.Text;
    using System.Threading.Tasks;
    
    namespace ConsoleApp2
    {
        internal class Program
        {
            static void Main()
            {
                //int[] days = { 31,28,31,30,31,30,31,31,30,31,30,31};
                /*int n = Convert.ToInt32 (Console.ReadLine());
                string[] a1 = Console.ReadLine().Split();
                double r = Convert.ToDouble(a1[0]);
                double b = Convert.ToDouble(a1[1]);
                double c = Convert.ToDouble(a1[2]);
                float pi = 3.1415926f;
                string S = ((r + b+c) / n).ToString("0.00");
                */
                string[] n =  Console.ReadLine().Split();
                string T = "no";
                //int score = 1500;
                int a = Convert.ToInt32(n[0]);
                int b = Convert.ToInt32(n[1]);
                //score += a * 5 + b * 5;
                //string Grade = "D";
                if (a <= 20 && b < 5)
                {
                    //Grade = "C";
                    T = "yes";
                }
    
    
                else if (a<=6)
                {
                    //Grade = "B";
                    T = "yes";
                }
                else if (b<=2)
                { T = "yes"; }
      
                Console.WriteLine(T);
                ;
                Console.ReadKey();
    
            }
        }
    }
    
    • 1

    信息

    ID
    26
    时间
    1000ms
    内存
    128MiB
    难度
    2
    标签
    递交数
    0
    已通过
    0
    上传者