摘要: import java.util.Arrays; public class ArraysSort_0 { public static void main(String args[]) { int[] a={1,0,2,4,3}; Arrays.sort(a); for(int i=0;i<a.len 阅读全文
posted @ 2020-12-16 18:54 然终酒肆 阅读(65) 评论(0) 推荐(0) 编辑
摘要: 复习bfs 这题我们用bfs 做 class Solution { public: int numSquares(int n) { queue <int> q; vector <int> dist(n+1,INT_MAX); q.push(0); dist[0] = 0; while(q.size( 阅读全文
posted @ 2020-12-16 18:51 然终酒肆 阅读(71) 评论(0) 推荐(0) 编辑
摘要: package homwk; import java.util.Arrays; import java.util.Scanner; public class hmwk6 { public static void main(String[] args) { @SuppressWarnings("res 阅读全文
posted @ 2020-12-16 17:50 然终酒肆 阅读(70) 评论(0) 推荐(0) 编辑
摘要: 二分查找 主要是其中的细节 这些位置的判断 不去自己调试真的不知道。。。到了考场上如果要手写,连bug也不知道 我也不知道程序设计要笔试是什么意思 本身就是很傻的行为 考作业题 考背诵么? package Test; public class Main { public static void ma 阅读全文
posted @ 2020-12-16 11:10 然终酒肆 阅读(65) 评论(0) 推荐(0) 编辑
摘要: package Test; import java.util.Scanner; import java.text.DecimalFormat; import java.util.Random; public class Main { static DecimalFormat df = new Dec 阅读全文
posted @ 2020-12-16 10:36 然终酒肆 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 1. 斐波那契 package Test; import java.util.Scanner; //import java.util.*; public class Main { public static int f(int a) { if(a<0) return -1; if(a == 0) { 阅读全文
posted @ 2020-12-16 10:30 然终酒肆 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 递归: import java.util.Scanner; //import java.util.*; public class Main { public static String f(int base,int num){ String str=""; String wait="01234567 阅读全文
posted @ 2020-12-16 09:50 然终酒肆 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 今天复习dfs 这个题很简单 我们用dfs搜 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val 阅读全文
posted @ 2020-12-16 09:30 然终酒肆 阅读(77) 评论(0) 推荐(0) 编辑