加载中...

摘要: ##输出路径 加入栈 struct node { int x; int y; }s[100]; int top=0; void dfs() { if(find) { for(i=1;i<=top;i++) printf(s[i].x,s[i].y) return } if(x&ybooked) re 阅读全文
posted @ 2022-09-24 08:51 biubidio 阅读(210) 评论(0) 推荐(0)
摘要: 给定n*n的矩阵,矩阵中有0和1两个数字,现要求矩阵中只包含0的矩形的数量。 枚举矩形左上角坐标𝑖,𝑗,矩形右边界𝑘,在𝑖,𝑗,𝑘一定的情况下能得到的满足条件的矩形个数和能向下扩展的高度有关,在𝑘增加的过程中不断更新可扩展的高度。 矩阵中数字如下,求矩阵中只包含0的矩形的数量。 0 0 阅读全文
posted @ 2022-09-23 19:09 biubidio 阅读(153) 评论(0) 推荐(0)
摘要: 设有城市1.2.3.4,求从1出发,不重复地经过4个城市且最终返回城市1的最短路径 问题分析: 将该题转为加权图模型,尝试所有可行路线,并比较得出最短路径。 #include<iostream> #define M 10 #define N 10 using namespace std; int d 阅读全文
posted @ 2022-09-23 12:57 biubidio 阅读(100) 评论(0) 推荐(0)
摘要: 题目: 下面是平平无奇的O(2^n)算法吖 #include<iostream> using namespace std; int ans=0; int n; int arr[100]= {0}; void f(int sum,int pos,int num) { if(pos>n) { if(su 阅读全文
posted @ 2022-09-22 20:18 biubidio 阅读(49) 评论(0) 推荐(0)
摘要: ##空格分隔输入格式 递归做法 //3 5 2 - * 7 + #include<iostream> using namespace std; string s[105]; int bolan(int &i){ if(s[i][0]>='0'&&s[i][0]<='9'){ return atof( 阅读全文
posted @ 2022-09-21 18:40 biubidio 阅读(56) 评论(0) 推荐(0)
摘要: ###字符串内嵌表达式 "hello, ${obj.name}. nice to meet you!" 另外,当表达式中仅有一个变量的时候,还可以将两边的大括号省略,如下所示: "hello, $name. nice to meet you!" ###函数的参数默认值 fun printParams 阅读全文
posted @ 2022-09-06 16:30 biubidio 阅读(20) 评论(0) 推荐(0)
摘要: ##Lambda表达式 {参数名1: 参数类型, 参数名2: 参数类型 -> 函数体} 例:maxBy函数 val list = listOf("Apple", "Banana", "Orange", "Pear", "Grape", "Watermelon") val lambda = { fru 阅读全文
posted @ 2022-09-06 15:18 biubidio 阅读(59) 评论(0) 推荐(0)
摘要: java: new Thread(new Runnable() { @Override public void run() { System.out.println("Thread is running"); } }).start(); 如果我们在Kotlin代码中调用了一个Java方法,并且该方法 阅读全文
posted @ 2022-09-06 15:12 biubidio 阅读(21) 评论(0) 推荐(0)
摘要: 单例模式一种最常见的Java写法: public class Singleton { private static Singleton inst<details> private Singleton() {} public synchronized static Singleton getInsta 阅读全文
posted @ 2022-09-05 23:33 biubidio 阅读(29) 评论(0) 推荐(0)