如果一个对象,只是希望他可以被创造出来,不希望被拷贝,那么最先想到的应该是将拷贝和复制运算符私有化: class A { public: A(){} ~A(){} private: A(const A&){} A& operator=(const A&) {} }; 但是书中大师认为,有两类函数仍然 ...
分类:
其他好文 时间:
2020-07-04 22:39:30
阅读次数:
64
public List<List<Integer>> threeSum(int[] nums) { List<List<Integer>> result = new ArrayList<>(); if(nums.length < 3)return result; Arrays.sort(nums); ...
分类:
其他好文 时间:
2020-07-04 22:39:06
阅读次数:
63
02-线性结构3 Reversing Linked List (25分) Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. Fo ...
分类:
其他好文 时间:
2020-07-04 22:36:18
阅读次数:
69
方法一: 整数值越界后符号改变 int i = 0, max, min; while(1) { if(i + 1 <= 0) { max = i; min = i + 1; break; } i++; } printf("int最大值%d,最小值%d\n", max, min); 方法二: 0(un ...
分类:
其他好文 时间:
2020-07-04 22:32:08
阅读次数:
69
public class Test { public static void main(String[] args) { int year = 0; do{ System.out.println("i love you--》" + year); year+=1; }while(year <= 100 ...
分类:
其他好文 时间:
2020-07-04 20:47:54
阅读次数:
50
题目描述 正整数A和正整数B 的最小公倍数是指 能被A和B整除的最小的正整数值,设计一个算法,求输入A和B的最小公倍数。 输入描述: 输入两个正整数A和B。 输出描述: 输出A和B的最小公倍数。 示例1 输入 5 7 输出 35 1 let str = readline(); 2 let arr = ...
分类:
编程语言 时间:
2020-07-04 19:15:34
阅读次数:
268
地址:http://codeforces.com/enter?back=%2Fcontest%2F1374%2Fproblem%2FD 题意: n个数,k x初始为0, 操作1:+ai,x++ 操作2:x++ 问使得所有数均能整除k的最小操作数。每个数只能被加一次。 解析: 假设有俩数:2 2 k= ...
分类:
其他好文 时间:
2020-07-04 18:52:58
阅读次数:
76
import java.util.Stack; /** * @Class LongestValidParentheses * @Description 32. 最长有效括号 * 给定一个只包含 '(' 和 ')' 的字符串,找出最长的包含有效括号的子串的长度。 * <p> * 示例 1: * 输入: ...
分类:
其他好文 时间:
2020-07-04 15:36:31
阅读次数:
51
const fs=require('fs'); //比较字符基类大小 相同返回0,str1>str2 返回1,str1<str2 返回-1, function str_compare(str1,str2){ let index=0; let dis=0; while (dis 0&&index<st ...
分类:
编程语言 时间:
2020-07-04 15:35:58
阅读次数:
79
功能:输入一个正整数,按照从小到大的顺序输出它的所有质因子(重复的也要列举)(如180的质因子为2 2 3 3 5 ) 最后一个数后面也要有空格 思路:网上参考大佬的思路,自己怎么也想不出来 private static void shape(int n){ StringBuilder result ...
分类:
其他好文 时间:
2020-07-04 15:14:18
阅读次数:
71