1 条题解

  • 0
    @ 2026-2-10 15:52:58

    C :

    #include<stdio.h>
    int main()
    {
    	int a;
    	int b;
    	int c;
    	scanf("%d %d %d",&a,&b,&c);
    	if(a%b==0 &&a%c==0)
    	{
    	printf("Yes\n");
    	}
    	else if(a%b!=0 ||a%c!=0)
    	{
    	printf("No\n");
    }
    }
    

    C++ :

    #include <stdio.h>
    int main()
    {
        int a,b,c;
        //freopen("1027A3.in","r",stdin);
        //freopen("1027A3.out","w",stdout);
        scanf("%d%d%d",&a,&b,&c);
        if(a%b==0 && a%c==0)
             printf("Yes\n");
        else
             printf("No\n");
     
        return 0;
    }
    

    Java :

    import java.util.Scanner;
    public class Main {
        public static void main(String[] args) {
            Scanner input = new Scanner(System.in);
            int a=input.nextInt(),b=input.nextInt(),c= input.nextInt();
            if(a%b==0&&a%c==0) System.out.println("Yes");
            else System.out.println("No");
        }
    }
    
    

    Python :

    # coding=utf-8
    #!/usr/bin/python2
    import sys
    import re
    import math
    a,b,c=(int(x) for x in raw_input().split(' '))
     
    if a%b==0 and a%c==0:
        print "Yes"
    else:
        print "No"
     
    

    C# :

    using System;
    using System.Collections.Generic;
    using System.Linq;
    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(' ');
                int a = Convert.ToInt16(n[0]); int b = Convert.ToInt16(n[1]); int c = Convert.ToInt16(n[2]);
                string T = "No";
                if (a %b==0 &&a%c==0) {
                    T = "Yes";
                }
             
                Console.WriteLine(T);
    
                Console.ReadKey();
    
            }
        }
    }
    
    • 1

    信息

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