下面是别人给我的代码: package com.bootdo; public class Test { public static void main(String[] args) { System.out.println(multiply("2354343543543", "3213213213")); } public static String multiply(String num1, String num2) { int l = num1.length()
一个简单的小算法来获取两个数的最大公约数, public class Test { public static void main(String[] args) { long result = gcd(15, 3); System.out.println(result); } public static long gcd(long m, long n) { while (n != 0) { long rem = m % n; m = n; n = rem; } return m; } }
[002-Add Two Numbers (单链表表示的两个数相加)] 原题 You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. In
No Pain No Game Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 2000 Accepted Submission(s): 851 Problem Description Life is a game,and you lose it,so you suicide. But you can not kill yours
D. Black Hills golden jewels time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In Rapid City are located the main producers of the Black Hills gold jewelry, a very popular product among tour
获得两个随机数(100以内),并放入数组中 public int[] getTwoRandom(){ int[] t = new int[2]; Random rand = new Random(); for(int i=0;i<t.length;i++) { t[i] = rand.nextInt(100); } return t; } 1.一般算法,连续整数检测法即从m和n中比较小的数开始一次遍历整数,如果有出现可以同时被m和n整除的数,就是最大公约数 //连续整数检测法 public in