在网上看到了一个C语言计算日期间隔的方法,咋一看很高深,仔细看更高神,很巧妙. 先直接代码吧 #include <stdio.h> #include <stdlib.h> int day_diff(int year_start, int month_start, int day_start , int year_end, int month_end, int day_end) { int y2, m2, d2; int y1, m1, d1; m1 = (month…
题意:求多个数的最小公倍数 很简单,但是我一开始的做法,估计会让结果越界(超过int的最大值) import java.util.*; import java.io.*; public class Main{ public static void main(String[] arg){ Scanner scan = new Scanner(new BufferedInputStream(System.in)); int n =scan.nextInt(); int[] nums = new in…
The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105. Input Input will consist of multiple problem instances. The f…
/*求两个数的最大公约数*/ CREATE FUNCTION f_GetGys ( @num1 BIGINT , @num2 BIGINT ) RETURNS BIGINT AS BEGIN DECLARE @m BIGINT; DECLARE @i BIGINT; IF ( @num1 < @num2 )--确保@num1永远是大的 @num2永远是小的 BEGIN SET @m = @num2; SET @num2 = @num1; SET @num1 = @m; END; SET @i =…