第六届福建省大学生程序设计竞赛(FZU2212—FZU2221)

ESP32-S3 SPI驱动SD卡与FATFS文件系统实践 SPI(串行外设接口)是嵌入式系统中常用的同步串行通信协议,通过主从架构实现全双工通信。其工作原理基于时钟同步和数据线传输,具有接线简单、占用引脚少的优势。在存储扩展场景中,SPI模式可驱动SD卡实现大容量数据存储,配合FATFS文件系统可提供标准化的文件管理能力。ESP32-S3作为乐鑫推出的高性能Wi-Fi/蓝牙双模芯片,其SPI外设支持高达80MHz时钟频率,结合ESP-IDF提供的sdspi_host驱动,开发者能快速实现SD卡存储方案。该技术广泛应用于物联网设备日志存储、传感器数据采集等场景,本实 阅读详情

Super Mobile Charger

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2212

解题思路:

水题。

AC代码:

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int a[105];

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        int n,m;
        scanf("%d%d",&n,&m);
        for(int i = 0; i < n; ++i){
            scanf("%d",&a[i]);
            a[i] = 100-a[i];
        }
        sort(a,a+n);
        int cnt = 0;
        for(int i = 0; i < n && m-a[i] >= 0; ++i){
            m -= a[i];
            ++cnt;
        }
        printf("%d\n",cnt);
    }
    return 0;
}

Common Tangents(两圆之间的公公切线)

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2213

解题思路:

告诉你两个圆的圆心与半径,要你找出他们的公共切线的个数。

套模板即可。

http://blog.csdn.net/piaocoder/article/details/41649089

AC代码:

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

struct Point{
    double x,y;
    Point(double x = 0,double y = 0):x(x),y(y){} // 构造函数,方便代码编写
};
typedef Point Vector;  //从程序实现上,Vector只是Point的别名

struct Circle{
    Point c;
    double r;
    Circle(Point c,double r):c(c),r(r){}
    Point getPoint(double a){
        return Point(c.x+cos(a)*r,c.y+sin(a)*r);
    }
};

//返回切线的条数。-1表示无穷条切线
//a[i]和b[i]分别是第i条切线在圆A和圆B上的切点
int getTangents(Circle A,Circle B){
    int cnt = 0;
    if(A.r < B.r)
        swap(A,B);
    int d2 = (A.c.x-B.c.x)*(A.c.x-B.c.x)+(A.c.y-B.c.y)*(A.c.y-B.c.y);
    int rdiff = A.r-B.r;
    int rsum = A.r+B.r;
    if(d2 < rdiff*rdiff)
        return 0;       //内含
    if(d2==0 && A.r==B.r)
        return -1;      //无限条切线
    if(d2 == rdiff*rdiff){//内切,1条切线
        return 1;
    }
    //有外公切线
    cnt += 2;
    if(d2 == rsum*rsum){//一条公切线
        ++cnt;
    }
    else if(d2 > rsum*rsum){//两条公切线
        cnt += 2;
    }
    return cnt;
}


int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        Point p1,p2;
        double r1,r2;
        scanf("%lf%lf%lf",&p1.x,&p1.y,&r1);
        Circle c1(p1,r1);
        scanf("%lf%lf%lf",&p2.x,&p2.y,&r2);
        Circle c2(p2,r2);
        printf("%d\n",getTangents(c1,c2));
    }
    return 0;
}


Knapsack problem(动态规划)

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2214

解题思路:

题目大意:

给你一个背包,容量为10^9,物品个数为500,价值和小于5000,求最大价值。

算法思想:

因为容量太大,所以不能按0-1背包问题去求解。注意到物品个数较小,而且价值和最大只有5000,所以可以逆向思维,求得对应价

值下最小的重量,即dp[i]表示总价值为i的最小重量是多少,则dp[j] = min(dp[j] , dp[j-val[i]]+vol[i]);最后从sum(物品总价值开始判

断)开始,找到第一个小于等于b(容量)的v即可。。。

AC代码:

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#define INF 0x3f3f3f3f
using namespace std;

int dp[5005];
int w[505],v[505];

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        int n,b;
        int sum = 0;
        scanf("%d%d",&n,&b);
        for(int i = 0; i < n; ++i){
            scanf("%d%d",&w[i],&v[i]);
            sum += v[i];
        }
        for(int i = 1; i <= sum; ++i)
            dp[i] = INF;
        dp[0] = 0;
        for(int i = 0; i < n; ++i){
            for(int j = sum; j >= v[i]; --j){
                if(dp[j-v[i]] != INF){
                    dp[j] = min(dp[j],dp[j-v[i]]+w[i]);
                }
            }
        }
        for(int i = sum; i >= 0; --i){
            if(dp[i] <= b){
                printf("%d\n",i);
                break;
            }
        }
    }
    return 0;
}

Simple Polynomial Problem(中缀表达式)

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2215

解题思路:

中缀表达式求值,数字栈存的是多项式。

AC代码:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

typedef long long ll;

struct Poly{
    ll a[1005];
    Poly operator + (const Poly &p) const{
        Poly tmp = {0};
        for(int i = 0; i < 1005; ++i){
            tmp.a[i] = (a[i]+p.a[i])%1000000007;
        }
        return tmp;
    }

    Poly operator * (const Poly &p) const{
        Poly tmp = {0};
        for(int i = 0; i < 1005; ++i){
            if(a[i] == 0)
                continue;
            for(int j = 0; j < 1005; ++j){
                if(p.a[j] == 0)
                    continue;
                tmp.a[i+j] += a[i]*p.a[j];
                tmp.a[i+j] %= 1000000007;
            }
        }
        return tmp;
    }
}pstk[1005];

char ostk[1005] = {'#'};
int ptop,otop,pri[350];
char str[1005];

void push(char op){
    if(ostk[otop]=='#' && op=='#')
        return;
    if(ostk[otop]=='(' && op==')'){
        --otop;
        return;
    }
    if(pri[ostk[otop]]<pri[op] || ostk[otop]=='('){
        ostk[++otop] = op;
        return;
    }
    if(ostk[otop--] == '+'){
        Poly p = pstk[ptop]+pstk[ptop-1];
        ptop -= 2;
        pstk[++ptop] = p;
    }else{
        Poly p = pstk[ptop]*pstk[ptop-1];
        ptop -= 2;
        pstk[++ptop] = p;
    }
    push(op);
}

void output(Poly &p){
    int i = 1000;
    while(i>=0 && p.a[i] == 0)
        --i;
    if(i == -1){
        puts("0");
        return;
    }
    for(int j = i; j >= 0; --j){
        printf("%lld",p.a[j]);
        if(j)
            putchar(' ');
    }
    putchar('\n');
}


int main(){
    pri['+'] = 2; pri['*'] = 3;
    pri['('] = 4; pri[')'] = 1;
    pri['#'] = 1;
    int T;
    scanf("%d",&T);
    while(T--){
        scanf("%s",str);
        ptop = 0; otop = 1;
        for(int i = 0; str[i]; ++i){
            if(str[i]>='0' && str[i]<='9'){
                Poly p = {0};
                p.a[0] = str[i]-'0';
                pstk[++ptop] = p;
            }else if(str[i]=='x'){
                Poly p = {0};
                p.a[1] = 1;
                pstk[++ptop] = p;
            }else{
                push(str[i]);
            }
        }
        push('#');
        output(pstk[ptop]);
    }
    return 0;
}

The Longest Straight

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2216

解题思路:

pre[i]代表数字i的前面0的总数目, 对于每个i找出符合条件的j ,使得i-j之间有恰好有m个0,然后更新答案ans。

AC代码:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

const int N = 100005;
int a[N],pre[N];

void solve(int n,int m){
    for(int i = 1; i <= n; ++i)
        pre[i] = pre[i-1]+(!a[i]);
    int ans = 0;
    int j = 1;
    for(int i = 1; i <= n; ++i){
        for(; j <= n; ++j){
            if(pre[j]-pre[i-1] > m)
                break;
        }
        if(j-i > ans){
            ans = j-i;
        }
    }
    printf("%d\n",ans);
}

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        memset(a,0,sizeof(a));
        int x,n,m;
        scanf("%d%d",&n,&m);
        int k = 0;
        for(int i = 0; i < n; ++i){
            scanf("%d",&x);
            if(!x) k++;
            a[x] = 1;
        }
        solve(m,k);
    }
    return 0;
}


Simple String Problem(状态压缩dp)

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2218

解题思路:

题目大意:

一个长为n(n<=2000)的字符串,由前k(k<=16)个小写字母组成,求两段子串A和B,A和B中间没有共用的字母类型,求len(A)*len(B)

的最大值。

算法思想:

二进制状态压缩,每一位的状态表示第i个字母存在状态,n^2的时可以枚举出所有子串的状态和长度。然后每次与(1<<k - 1)异或就

是不含相同的子串状态。但是不能直接对每一种状态枚举他的子集和异或值,这样太大了,肯定会超时,因此我们可以用dp[tmp]表

示tmp状态所有子集的最大长度。

先状态转移一下,最后遍历所有的状态和其异或状态就可以更新出答案。

AC代码:

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;

const int N = 2005;
char str[N];
int dp[(1<<16)+10];

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        int n,m;
        scanf("%d%d",&n,&m);
        scanf("%s",str);
        memset(dp,0,sizeof(dp));
        for(int i = 0; i < n; ++i){
            int tmp = 0;
            for(int j = i; j < n; ++j){
                tmp |= 1<<(str[j]-'a');
                dp[tmp] = max(dp[tmp],j-i+1);
            }
        }
        int len = 1<<m;
        for(int i = 0; i < len; ++i){
            for(int j = 0; j < m; ++j){
                if((1<<j) & i)
                    dp[i] = max(dp[i],dp[i^(1<<j)]);
            }
        }
        int ans = 0;
        for(int i = 0; i < len; ++i){
            ans = max(ans,dp[i]*dp[(len-1)^i]);
        }
        printf("%d\n",ans);
    }
    return 0;
}

StarCraft(哈夫曼树+优先队列)

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2219

解题思路:

类似于哈夫曼树的合并方式,对于当个农民(工蜂)来说,算上分裂技能,建造是不断两两并行的,建造时间越小,合并的价值就

越小。合并后的时间去被合并两者的较大值+K。初始农民的数量就是合并的终点。


然后问题就可以化简为,给你一堆数字,每次把次小值+k,再删除当前最小值,直到剩下m个数字。

使用优先队列求解,将默认排序的大根堆,改成小根堆即可。

AC代码:

#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;

priority_queue<int,vector<int>,greater<int> > q;

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        int x,n,m,k;
        scanf("%d%d%d",&n,&m,&k);
        for(int i = 0; i < n; ++i){
            scanf("%d",&x);
            q.push(x);
        }
        while(n > m){
            q.pop();
            q.push(q.top()+k);
            q.pop();
            --n;
        }
        while(q.size() != 1)
            q.pop();
        printf("%d\n",q.top());
        q.pop();
    }
    return 0;
}


Defender of Argus(优先队列)

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2220

解题思路:

类似于炉石传说中的“ 奥古斯守卫者 ”,不断选取最优解即可。。。

AC代码;

#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;

const int N = 100005;
int n,k;
int a[N],l[N],r[N];
bool vis[N];

struct node{
    int l,r,val;
    node(int _l,int _r):l(0),r(0){
        l = _l;
        r = _r;
        val = a[_l]+a[_r];
    }
    bool operator < (const node& no) const{
        return val < no.val;
    }
};

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        scanf("%d%d",&n,&k);
        for(int i = 1; i <= n; ++i)
            scanf("%d",&a[i]);
        if(n == 0){
            if(k == 0 || k == 1)
                printf("0\n");
            else
                printf("%d\n",4+(k-2)*5);
            continue;
        }
        if(n == 1){
            printf("%d\n",a[1]+1+(k-1)*5);
            continue;
        }
        memset(vis,false,sizeof(vis));

        for(int i = 1; i <= n; ++i){
            l[i] = i-1;
            r[i] = i+1;
        }
        r[0] = 1;
        l[n+1] = n;

        priority_queue<node> q;
        for(int i = 1; i < n; ++i)
            q.push(node(i,i+1));
        bool put = false;
        int sum = 0,last = n;

        while(!q.empty() && k > 0){
            node cur = q.top(); q.pop();
            if(cur.val <= 3 && put == true)
                break;
            int ll = cur.l,rr = cur.r;
            if(vis[ll] || vis[rr])
                continue;

            sum += (a[ll]+a[rr]+2);
            last -= 2;

            --k;
            vis[ll] = true; vis[rr] = true;
            int _l = l[ll], _r = r[rr];

            l[_r] = _l;
            r[_l] = _r;
            put = true;
            if(_l!=0 && _r!= n+1)
                q.push(node(_l,_r));
        }

        if(k>0 && last==1 && a[r[0]]>3){
            sum += a[r[0]] + 2;
            --k;
        }
        sum += k*5;
        printf("%d\n",sum);
    }
    return 0;
}

RunningMan

题目链接:

http://acm.fzu.edu.cn/problem.php?pid=2221

解题思路:

将跑男n均分为3份,取其中较小两份cnt1,cnt2,如果m>=cnt1+cnt2+2;则跑男不能一定获胜,反之则能。

AC代码:

#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        int n,m;
        scanf("%d%d",&n,&m);
        int cnt1 = n/3;
        n -= cnt1;
        int cnt2 = n/2;
        if(cnt1+cnt2+2 <= m)
            puts("No");
        else
            puts("Yes");
    }
    return 0;
}


嵌入式开发必备:手把手教你用DB-9连接器搞定RS-232串口通信(附万用表测试技巧) 本文详细解析了嵌入式开发中RS-232串口通信的硬件连接核心。从DB-9连接器的引脚定义入手,深入讲解DTE与DCE设备角色,明确直连线与交叉线的选择法则,并重点分享了使用万用表进行线缆连通性测试、电压测量及故障诊断的实战技巧,帮助开发者彻底掌握串口通信的硬件连接与排查方法。 阅读详情

相关推荐

【嵌入式底层知识修炼】按键和LED共用IO口的分时复用扫描方法

文章目录01 - PCB原理图例程02 - 分时复用的注意项和设计2.1 - 注意项2.2 - 设计03 - 代码实现 只要我跑的速度够快,寂寞就追不上我 只要Key和Led切换速度够快,人眼就看不出来 ————小白   如果你存在按键Key和显示Led共用同一个IO时,需要分时复用的需求,则可以移植代码进行使用: 代码所占code少于0.5K 线程安全,中断安全 可移植性高,配置容易 注意:系统需要存在一个至少为1ms的时钟中断 01 - PCB原理图例程   举2个Key和Led共用IO口的

单眼皮根号三的博客 1万+

springboot高校实验室教学管理系统-计算机设计毕业源码06983

本文旨在研究基于Spring Boot技术的高校实验室教学管理系统的设计与实现,旨在提供一个高效、便捷和可靠的实验室教学管理平台。实验室教学在高校教育中占据重要地位,然而传统的实验室管理方式存在一些问题,如人工操作繁琐、资源调度困难等,需要一个功能完善的在线平台来提升实验室教学的效率和管理水平。本文将采用Spring Boot作为后端开发框架,结合相关的技术和工具,设计和实现一个基于Spring Boot的高校实验室教学管理系统。首先,我们将进行系统需求分析,了解高校实验室教学流程和管理需求,确定系统的功能

weixin_MZ_ZXD001的博客 1192

AI论文写作工具对比:千笔AI与文途AI实战测评

AI写作工具正逐步改变学术写作生态,其核心原理是通过自然语言处理技术实现文本生成与优化。这类工具的技术价值在于提升写作效率,降低学术入门门槛,特别适合文献综述、研究方法设计等标准化环节。在实际应用中,不同工具各有侧重:千笔AI擅长结构化写作与量化分析,文途AI则聚焦质性研究与思维拓展。本科生使用这些AI论文助手时,需特别注意学术伦理边界,所有生成内容必须经过严格人工校验。合理运用AI工具能有效缓解论文写作中的文献处理、方法表述等痛点,但核心学术思维仍需研究者自主构建。

weixin_34023982的博客 462

Spring Boot 两个实例同时关单,怎么验证订单只关一次?

订单超时关单任务在单机上很简单:定时查找逾期订单,改状态,再通知下游。部署两个实例后,两边都可能扫到同一条订单。即便调度平台只派发一次,执行节点崩溃后也可能重派。本文用一条永不重新打开的合成订单做演示。并发付款、重新开单和多租户的真实规则要由业务先定义。

在北京 232

Verilog基本代码结构及常用语句always、begin...end解读

Verilog基本代码结构及常用语句always、begin...end解读 线性反馈以为寄存器(LFSR)

weixin_62380586的博客 1万+

TM1621/HT1621 段码LCD驱动器

TM1621 LCD 驱动器

qq_45325304的博客 1万+

spring Boot前后端分离项目引入Spring Security+JWT实现登录与权限校验

本文基于Spring Boot 4.1.2与Vue2实现前后端分离项目,集成Spring Security与JWT实现登录认证与权限控制。通过自定义登录接口、UserDetailsService及JWT过滤器,完成用户认证、Token生成与校验流程,并结合Redis存储用户信息提升性能。项目采用Fastjson处理JSON数据,实现安全高效的无状态身份验证机制。

fzt12138的博客 223

【微服务】Spring AI Alibaba Jmus 从部署到项目实战详解

Spring AI Alibaba Jmus 从部署到项目实战详解

congge 4204

Spring Boot SSE 上线后不实时、频繁断线?Nginx 缓冲、心跳与连接回收实战

Spring Boot SSE 接口本地能够实时推送,上线经过 Nginx 后却出现消息延迟、连接频繁断开、客户端退出后资源无法及时释放等问题。本文结合 Spring MVC SseEmitter、Nginx 响应缓冲、心跳机制与浏览器 EventSource 重连行为,提供 Java 示例、代理配置、curl 验证步骤及生产排查清单,并解释多实例部署、事件重放与消息可靠性的边界。

代码不止,探索不息 450

Unity 编辑器篇|(一)MenuItem菜单栏

"一级菜单/二级菜单上/三级菜单""一级菜单/二级菜单中 %#_B""一级菜单/二级菜单下 %&_C""一级菜单/二级菜单中 %#_B""一级菜单/二级菜单下 %&_C""GameObject/二级菜单""CONTEXT/组件名/菜单名""一级菜单/二级菜单上 #_A""Assets/二级菜单""一级菜单/二级菜单下""一级菜单/二级菜单上""一级菜单/二级菜单中""一级菜单/二级菜单下""一级菜单/二级菜单下""一级菜单/二级菜单上""一级菜单/二级菜单中""一级菜单/二级菜单下""自定义/Test"

游戏开发小Y的博客 13万+

ROS2 - 乐动激光雷达 LD06

STL-06P 主要由激光测距核心,无线传电单元,无线通讯单元,角度测量单元、电机驱动单元和机械外壳组成。STL-06P 测距核心采用 DTOF 技术,可进行每秒 5000 次的测距。每次测距时,雷达发射出红外激光,激光遇到目标物体后被反射到单光子接收单元。

机器人控制与仿真应用 3503

用 Vue 3 和 Spring Boot 构建煤矿三屏驾驶舱

该调度室驾驶舱系统以Vue3与Vite构建,通过单一入口集成人员安全、生产监测与用电监测三类视图,实现数据统一展示。各视图共用导航与状态栏,支持通过URL切换并保留全屏与历史记录。人员安全页基于HTTP首屏与SSE推送实时更新井下人数、告警与定位;生产页区分班次与时段完成率,动态展示产量趋势;用电页联动拓扑图与负荷曲线,精准呈现回路负载与电量。采用版本号防覆盖机制保障数据一致性,布局使用CSS Grid优化空间分配,确保关键信息清晰可读。系统已通过多分辨率验证,后续将对接真实数据源,实现全场景应用。

王元帅的博客 271

2026华为OD机试真题 10月28日 新系统 - AI推理任务并行额度

华为OD机试真题 新系统【AI推理任务并行额度】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解,以及在线OJ模拟做题。华为OD机试真题 【AI推理任务并行额度】多语言题解.

qq_45776114的博客 294

Spring Boot 依赖管理原理

Spring Boot 的依赖管理分三层: spring-boot-dependencies 维护版本清单,用 <properties> 定义版本、用 <dependencyManagement> 登记依赖; spring-boot-starter-parent 继承它,项目通过 <parent> 接入,顺带拿到插件管理和资源过滤; 不能继承 parent 时,用 <scope>import</scope> 导入 BOM,效果只限版本管理。 starter 本身不含代码,只是一组不带版本的依赖声明;版本统

qq_62915473的博客 255

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

Spring Boot结构化日志实战:一行配置输出JSON日志

很多人为了加自定义输出会自己写,这时 Spring Boot 的默认配置就失效了,结构化日志也会跟着失效。解决方法是:在你的自定义配置里,把普通 Encoder 换成</</</</</</关键是这个类,它接收format(就是ecsgelflogstash)和charset两个参数。这样即使你有自定义 Appender,也能继续享受结构化日志。结构化日志解决什么问题:把日志从「人读的文本」变成「机器读的字段化 JSON」,让日志平台能直接检索、聚合,告别 grep 和正则硬拆。它怎么工作的。

会编程的吕洞宾的博客 220

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

拒绝 Prompt 注入:用 Spring Boot 打造大模型安全护栏(Guardrails)

在AI Agent时代,Prompt注入成为新型安全威胁。本文基于Spring Boot与Spring AI,构建双层安全护栏:输入端通过正则与敏感词拦截恶意指令,输出端对隐私数据(如手机号)进行脱敏。利用Advisor实现AOP式防护,确保不信任用户输入与模型输出。面对绕过挑战,需结合语义理解、对抗样本检测等进阶策略,筑牢AI系统边界安全防线。

m0_72786509的博客 210

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

【JavaEE】Spring Boot 博客系统案例

本文基于Spring Boot 3.3.5构建前后端分离博客系统,集成JWT实现身份认证与权限控制,支持登录、文章增删改查及安全渲染。采用MyBatis-Plus操作MySQL,通过拦截器校验用户身份与操作权限,确保接口安全。项目结构清晰,统一响应格式,前端使用jQuery调用API,后端分层设计保障可维护性。

REGARD712的博客 366

基于Spring Boot和Vue的法律咨询案件进度与文书管理系统设计与实现

按实际代码介绍客户、律师、助理和管理员的页面分工,以及案件节点、预约确认、文书正文和版本记录管理。说明文书生成按钮的示例实现,并给出 Spring Boot、Vue 与 H2 环境的本地启动方法。

weixin_63587281的博客 217

Spring Boot 接口返回 403 而非 401:方法级鉴权不生效的根因

未带凭证的请求返回403而非401,前端登录跳转分支失效。逐层复现并核对入口点配置与方法安全开关即可定位两类根因。该排查适用于自建安全过滤链的服务,复杂OAuth2应交由网关处理。

昨日种种,皆成今我。今日种种,皆成新我。 229

基于Spring Boot和Vue的客服工单质检与知识推荐系统设计与实现

介绍工单受理和解决、关键词示例质检、结果复核与知识采纳反馈,并给出 Spring Boot、Vue 和 H2 环境的本地启动方法。

weixin_63587281的博客 244

Spring Boot 项目搭建的四种方式

Spring Boot 项目怎么建?常见的有四种:用 IDEA 自带的向导、去官网生成、用阿里云的镜像生成,或者拿一个普通 Maven 工程改造。四种方式产出的项目结构一样,区别在入口和网络环境。

qq_62915473的博客 173

采购管理系统(Spring Boot 3 + Vue 3)

一套可直接运行的采购管理系统,包含供应商、商品、采购订单审批、入库、库存流水、用户权限、个人中心与数据看板。支持用户头像与商品图片上传(本地存储、缩略图展示、点击大图预览),个人中心可修改资料和密码。系统自带 8 张真实商品图片,位于。

深耕开发,专注编程实战。分享源码解析、项目搭建、问题排查笔记,沉淀技术,持续更新。 239

第四篇:Spring Boot + MySQL + RabbitMQ 实战

结果线上仍然出现“数据有了、消息没到”:事务提交成功之后、kafka.send() 执行之前,进程被 kill 或者 Broker 短暂不可用,这个窗口里的消息静默丢失,生产者只打了一行日志,没有任何重试。afterCommit 解决的是“提前发”和“回滚还发”,它把消息发送挪到了事务之外,但挪出去之后,发送和提交之间不再有任何原子性保障。两条路径的投递保证都是至少一次。已发送的记录如果不清理,表会持续膨胀,查询 PENDING 记录的索引扫描成本上升,relay 的投递延迟会先恶化,然后磁盘才告警。

在数字世界里构建秩序,在逻辑缝隙中寻找灵感。分享技术思考、读书笔记与生活随笔,记录一个工科生的所见、所思、所得。 314

Spring Boot 4.1 → 4.2 升级实战:RestTemplate 渐进退役、AMQP Starter 拆分与 Tomcat 重定向行为翻转

Spring Boot 4.2 升级聚焦架构清理:RestTemplate 渐进退役,需通过 RestClient 过渡迁移调用点;amqp starter 语义漂移,须切换至 rabbitmq starter;Tomcat 属性迁移至 server.tomcat.servlet.*,且相对重定向默认值由 false 变为 true,行为静默翻转。建议按“配置封装→调用改写→配置迁移”三步走,规避编译与运行时风险。附关键变更清单,确保平滑升级。

weixin_37549398的博客 182

偶发读到旧数据:Spring Boot 3 里 @Cacheable 与事务的时序坑

偶发旧读源于缓存写入先于事务提交,回滚后脏缓存也不清理。Redis key 对比可验证时序窗口,移出事务和延迟双删各有代价。适合写低读高容忍不一致的服务,高频写入需另选方案。

昨日种种,皆成今我。今日种种,皆成新我。 206
上一篇: 2016年 蓝桥杯省赛测试题(Java)
下一篇: The 5th Zhejiang Provincial Collegiate Programming Contest(ZOJ2965—ZOJ2976)
yphacker
博客等级 码龄12年 199粉丝 540原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值