import java.util.ArrayList;public class Prime_Number { public static void main(String[] args) { System.out.println("\n for一百以内的素数 "); //1既不是质数也不是素数,使用 ...
分类:
编程语言 时间:
2020-02-16 13:06:13
阅读次数:
77
Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the ...
分类:
其他好文 时间:
2020-02-16 01:35:33
阅读次数:
58
题目 给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字。 如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。 您可以假设除了数字 0 之外,这两个数都不会以 0 开头。 示例: 输入:(2 4 3) ...
分类:
其他好文 时间:
2020-02-15 00:14:20
阅读次数:
102
题目:https://vjudge.net/problem/POJ-3126#author=541607120101 简单bfs,但我用了很笨比的做法。。把每一位数都保存下来然后逐位改值检查并加入队列,直到找到所求值,具体见代码。 1 #include <stdio.h> 2 #include <s ...
分类:
其他好文 时间:
2020-02-14 16:38:49
阅读次数:
95
Given two numbers, hour and minutes. Return the smaller angle (in sexagesimal units) formed between the hour and the minute hand. Example 1: Input: ho ...
分类:
其他好文 时间:
2020-02-13 09:30:42
阅读次数:
57
知识点:c++中将string转换为int 于double的函数(原来还有这种好东西) 转化为int,有两种方式: string s = "123"; int c = atoi(s.c_str()); 或者int c = stoi(s);将string转化为double,也是两种方式。string ...
分类:
其他好文 时间:
2020-02-13 00:21:28
阅读次数:
137
(1)数组排序及插入元素 1 package JavaEE.JavaBaseExampleTest.Array; 2 3 import java.util.Arrays; 4 /** 5 * 使用sort()方法对Java数组进行排序,及使用 insertElement () 方法向数组插入元素 6 ...
分类:
编程语言 时间:
2020-02-12 16:15:53
阅读次数:
81
200. Numbers of Islands *********************** class Solution { // 首先定义四个方向的向量,方便计算矩阵上下左右的位置 final static int [][]dirs = {{-1, 0}, {1, 0}, {0, -1}, { ...
分类:
其他好文 时间:
2020-02-12 11:16:57
阅读次数:
91
In a row of dominoes, A[i] and B[i] represent the top and bottom halves of the i-th domino. (A domino is a tile with two numbers from 1 to 6 - one on ...
分类:
其他好文 时间:
2020-02-11 11:48:25
阅读次数:
101
The Travelling Salesman spends a lot of time travelling so he tends to get bored. To pass time, he likes to perform operations on numbers. One such op ...
分类:
其他好文 时间:
2020-02-11 00:15:05
阅读次数:
66