1 条题解

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

    C :

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

    C++ :

    #include <stdio.h>
    int main(int argc, char *argv[])
    {
        int a;
        //freopen("1026A5.in","r",stdin);
        //freopen("1026A5.out","w",stdout);
        scanf("%d",&a);
         
        if(a%7==0&&a%5==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 n = input.nextInt();
            if (n % 7 == 0 && n % 5 == 0) {
                System.out.println("Yes");
            } else System.out.println("No");
        }
    }
    
    

    Python :

    # coding=utf-8
    #!/usr/bin/python2
    import sys
    import math
    str = int(input())
    if str%5==0 and str%7==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");
                */
                int a=Convert.ToInt16( Console.ReadLine());
                string b = "No";
                if (a %5==0 &&a%7==0) {
                    b = "Yes";
                }
             
                Console.WriteLine(b);
    
                Console.ReadKey();
    
            }
        }
    }
    
    • 1

    判断某整数是否既是5又是7的整数倍

    信息

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