- 博客(7)
- 收藏
- 关注
原创 深度搜索DFS
算法思想 回溯法(探索与回溯法)是一种选优搜索法,又称为试探法,按选优条件向前搜索,以达到目标。但当探索到某一步时,发现原先选择并不优或达不到目标,就退回一步重新选择,这种走不通就退回再走的技术为回溯法,而满足回溯条件的某个状态的点称为“回溯点”。 int check(参数) { if(满足条件) return 1; return 0; } void dfs(int step) { 判断边界 { 相应操作 .
2022-04-17 20:56:14
51
原创 全排列:递归算法
package 蓝桥杯; import java.util.*; public class 全排列2 { public static void main(String args[]) { f("ABC".toCharArray(),0); } private static void f(char[] aa, int k) { // TODO 自动生成的方法存根 if(k==aa.length-1) { System.out.println(aa); return; } .
2022-04-03 20:06:15
458
原创 Java Calendar类解析
import java.util.Calendar; public class aa { public static void main(String args[]) { Calendar cal = Calendar.getInstance(); for(int year = 1999;year<10000;year+=100) { cal.set(Calendar.YEAR,year); cal.set(Calendar.MONTH, 11); cal.set(C.
2022-03-27 18:40:03
114
原创 工作室课题测试答案
0030 #include<stdio.h> int main(void) { int a; double b; char c; scanf("%3d%lf|%c",&a,&b,&c); printf("%-8d|%8.1f|%c\n",a,b,c); return 0; } 0054 #include<iostream> #include<string.h> #include<stdio.h> #include
2022-03-20 22:56:50
101
原创 工作室课题习题练习答案
0015 #include <cstdio> #include <iostream> using namespace std; const int mod = 20100713; typedef long long ll; const int N = 1e6+10; ll f[N];//k! ll quick(ll a,ll n){ ll ans = 1; while(n){ if(n&1) ans = (ans*a)%mod; a = (a*a)%mod;
2022-03-20 22:52:53
174
原创 工作室课题:第一周学习知识2
算法:直接插入排序 #include<iostream> #include<string> using namespace std; const int MaxSize = 100; int main() { int n; cin >> n; int a[MaxSize]; for (int i = 1; i <= n; i++) { cin >> a[i]; } int r[MaxSize]; r[1] = a[1]; for
2022-03-20 20:54:59
847
原创 【无标题】工作室课题:学习总结1
本周主要是针对排序算法进行训练,同时在学习算法的同时也更多的了解 到一些函数的功能。 1.swap函数: swap函数是c++中较为实用且比较强大的函数。 C ++中标准库中的swap()函数可以交换任何数据类型的值,包括int,float,string等,甚至数据结构,如数组,堆栈和队列等。 功能1:交换两个整数值 #include <iostream> using namespace std; int main() { //values before swapping
2022-03-20 20:45:45
690
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人