Codeforces Round #329 (Div. 2) (593A,593B,593C,593D)

光谱预处理最简单实现方法--基于OpenSA光谱分析库 系列文章目录 “光晰本质,谱见不同”,光谱作为物质的指纹,被广泛应用于成分分析中。伴随微型光谱仪/光谱成像仪的发展与普及,基于光谱的分析技术将不只停留于工业和实验室,即将走入生活,实现万物感知,见微知著。本系列文章致力于光谱分析技术的科普和应用。 文章目录系列文章目录前言一、数据来源二、代码解读2.1 读取数据2 .2 划分数据集2 .3 返回训练集和测试集并绘制光谱图片2.4 建立1-D CNN模型2.5 训练1-D CNN模型2.6 测试1-D CNN模型2.7 运行CNN模型,并用查看结果总结 阅读详情

2Char

题目链接:

http://codeforces.com/problemset/problem/593/A

解题思路:

For each letter will maintain the total length of words (cnt1ci), which found it was alone, and for each pair of letters will maintain the total length of words that contains only them (cnt2ci, cj).

For each row, count a number of different letters in it. If it is one, then add this letter to the length of the word. If two of them, then add to the pair of letters word`s length.

Now find a pair of letters that will be the answer. For a pair of letters ci, cj answer is cnt1ci + cnt1cj + cnt2ci, cj. Among all these pairs find the maximum. This is the answer.

The overall complexity is O (total length of all strings + 26 * 26)

算法思想:

没什么难的,想清楚了一下子就写出来了,2个字母,最多26*26,所以用一个二位数组保存就行了,注意只有一个字母的情况。

AC代码:

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

char str[105][1005];
int num1[35][35];
int num2[35];
int ch[5];

int main(){
    int n;
    while(~scanf("%d",&n)){
        memset(num1,0,sizeof(num1));
        for(int i = 0; i < n; i++){
            scanf("%s",str[i]);
            int l = strlen(str[i]),sum = 0,flag = 0;
            memset(num2,0,sizeof(num2));
            memset(ch,0,sizeof(ch));
            for(int j = 0; j < l; j++){
                num2[str[i][j]-'a']++;
                sum++;
            }
            int dis = 0;//字母的个数
            for(int j = 0; j < 30; j++){
                if(num2[j]){
                    ch[dis++] = j;
                }
                if(dis >= 3){
                    flag = 1;
                    break;
                }
            }
            if(flag)
                continue;
            if(ch[1] == 0){
                for(int j = 0; j < ch[0]; j++)
                    num1[j][ch[0]] += sum;
                for(int j = ch[0]+1; j < 30; j++)
                    num1[ch[0]][j] += sum;
            }
            else{
                if(ch[0] > ch[1])
                    swap(ch[0],ch[1]);
                num1[ch[0]][ch[1]] += sum;
            }
        }
        int ans = 0;
        for(int i = 0; i < 30; i++){
            for(int j = 0; j < 30; j++){
                ans = max(ans,num1[i][j]);
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

Anton and Lines

题目链接:

http://codeforces.com/problemset/problem/593/B

解题思路:

Note that if a s line intersects with the j th in this band, and at x = x1 i th line is higher, at x = x2 above would be j th line. Sort by ycoordinate at x = x1 + eps, and x = x2 - eps. Verify that the order of lines in both cases is the same. If there is a line that its index in the former case does not coincide with the second, output Yes. In another case, derive No. The only thing that can stop us is the intersection at the borders, as in this case we dont know the sorts order. Then add to our border x1 small eps, and by x2 subtract eps, and the sort order is set uniquely. The overall complexity is O(nlogn)

这题想多了,其实只要用两个相同的结构体保存,一个根据y1排序,一个根据y2排序,然后再O(n)的查找就行了。

AC代码:

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

typedef long long ll;
ll k[100005],b[100005];
int vis[100005];
struct node{
    int id;
    ll y1,y2;
}no1[100005],no2[100005];

bool cmp1(node a,node b){
    if(a.y1 == b.y1)
        return a.y2 < b.y2;
    return a.y1 < b.y1;
}

bool cmp2(node a,node b){
    if(a.y2 == b.y2)
        return a.y1 < b.y1;
    return a.y2 < b.y2;
}

int main(){
    int n;
    while(~scanf("%d",&n)){
        memset(vis,0,sizeof(vis));
        ll x1,x2;
        scanf("%lld%lld",&x1,&x2);
        for(int i = 0; i < n; i++){
            scanf("%lld%lld",&k[i],&b[i]);
            no1[i].id = i;no2[i].id = i;
            no1[i].y1 = no2[i].y1 = k[i]*x1+b[i];
            no1[i].y2 = no2[i].y2 = k[i]*x2+b[i];
        }
        sort(no1,no1+n,cmp1);
        sort(no2,no2+n,cmp2);
        int k = 0,flag = 0;
        for(int i = 0; i < n; i++){
            while(no1[i].y1 == no2[k].y1 || vis[k])
                k++;
            if(k < n && no1[i].y2 > no2[k].y2){
                flag = 1;
                break;
            }
            vis[i] = 1;
        }
        if(flag)
            printf("YES\n");
        else
            printf("NO\n");
    }
    return 0;
}


Beautiful Function

题目链接:

http://codeforces.com/problemset/problem/593/C

解题思路:

One of the answers will be the amount of such expressions for each circle in the coordinate x and similarly coordinate y: 

For a = 1, b = abs(t - i), it can be written as 

Consider the a - b + abs(a - b):

if a ≤ b, то a - b + abs(a - b) = 0,

if a > b, то a - b + abs(a - b) = 2a - 2b

Now consider what means a > b:

1 > abs(t - i)

i > t - 1 and i < t + 1.

For integer i is possible only if i = t.

That is, this bracket is not nullified only if i = t.

Consider the 2a - 2b = 2 - 2 * abs(t - i) = 2. Then  differs from the wanted position by no more than 1, but since all the radiuses are not less than 2, then this point belongs to the circle.

The overall complexity is O(n).

算法思想:

根据quailty大牛贴吧回答来的:

先特判掉1个点的情形,
然后尝试将x坐标和y坐标分开考虑,
对于x坐标,希望能够找到一个f(t)使得f(i)=x[i],i=1,2,...,n,
由于可以使用绝对值函数,
考虑构造一个f(t)=\sum_{i=1}^{n}{a[i]*abs(t-i)},
但是发现每一段的斜率奇偶性是相同的,
亦即所有x[i]-x[i-1](i=2,3,...,n)的奇偶性是相同的,
很显然这不能保证,
注意到每个圆的半径至少是2,
即使把每个点的横纵坐标都改变1,还是在各自的圆内,
因此可以将所有奇数坐标-1,
那么容易知道a[i]=((x[i+1]-x[i])-(x[i]-x[i-1]))/2,i=2,3,...,n-1,
再利用第一段的斜率x[2]-x[1]可以得到a[1]-a[n]的值,
不妨令a[n]=0,于是a[1]也可以知道,
那么此时已经满足f(i)-f(i-1)=x[i]-x[i-1],i=2,3,...,n,
再补上一个常数使得f(1)=x[1]即可,
输出异常恶心,特别要注意如果中间系数<0或者>50,也要拆开来写。

AC代码:

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int x[55],y[55],d[55],a[55];
vector<pair<int,int> >v;
void work(int n)
{
    for(int i=1;i<n;i++)
        d[i]=x[i]-x[i-1];
    for(int i=2;i<n;i++)
        a[i]=(d[i]-d[i-1])/2;
    a[1]=d[1];
    for(int i=2;i<n;i++)
        a[1]+=a[i];
    int det=x[0];
    for(int i=1;i<=n;i++)
        det-=a[i]*(i-1);
    v.clear();
    for(int i=1;i<n;i++)
        if(a[i])v.push_back(make_pair(a[i],i));
    while(det<0)
    {
        v.push_back(make_pair(-50,0));
        det+=50;
    }
    while(det>0)
    {
        v.push_back(make_pair(min(det,50),0));
        det-=min(det,50);
    }
    if((int)v.size()==0)printf("0");
    else if((int)v.size()==1)
    {
        if(v[0].first<0)printf("(0-");
        if(!v[0].second)
            printf("%d",abs(v[0].first));
        else
            printf("(%d*abs((t-%d)))",abs(v[0].first),v[0].second);
        if(v[0].first<0)printf(")");
    }
    else
    {
        for(int i=1;i<(int)v.size();i++)
            printf("(");
        for(int i=0;i<(int)v.size();i++)
        {
            if(i==0)
            {
                if(v[i].first<0)printf("((0-%d)*abs((t-%d)))",abs(v[i].first),v[i].second);
                else printf("(%d*abs((t-%d)))",abs(v[i].first),v[i].second);
            }
            else
            {
                printf("%s",(v[i].first<0 ? "-" : "+"));
                if(!v[i].second)
                    printf("%d",abs(v[i].first));
                else
                    printf("(%d*abs((t-%d)))",abs(v[i].first),v[i].second);
                printf(")");
            }
        }
    }
    printf("\n");
}
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
        scanf("%d%d%*d",&x[i],&y[i]);
    if(n==1)
    {
        printf("%d\n%d\n",x[0],y[0]);
    }
    else
    {
        for(int i=0;i<n;i++)
        {
            if(x[i]&1)x[i]--;
            if(y[i]&1)y[i]--;
        }
        work(n);
        memcpy(x,y,sizeof(y));
        work(n);
    }
    return 0;
}

Happy Tree Party(树链剖分)

题目链接:

http://codeforces.com/contest/593/problem/D

解题思路:

Consider the problem ignoring the second typed requests. We note that in the column where all the numbers on the edges of  >  1 maximum number of assignments to  before x will turn into 0 is not exceeds 64. Indeed, if all the Rv = 2, the number of operations can be assessed as log2(x). Hang the tree for some top and call it the root.

Learn how to solve the problem, provided that for every v Rv > 1 and no requests of the second type. For each vertex except the root, we have identified it as the ancestor of the neighbor closest to the root. Suppose we had a request of the first type from the top a to b vertices with original number x. We divide the road into two vertical parts, one of which is close to the root, while the other moves away. We find all the edges in this way. To do this, we calculate the depth of each node to the root of the distance. Now we will go up in parallel to the tree of the two peaks, until he met a total. If in the course of the recovery, we have been more than 64 edges, in the substitutions  we get x = 0 and we can at the current step to stop the algorithm search. Thus, we make no more than O(log(x)) operations.

Let`s turn to the problem, where Rv > 0. We note that our previous solution in this case can work for O(n). Since the passage of the edge with Rv = 1 our value does not change. We reduce this problem to the above consideration. Compress the graph, that is, remove all single edges. To do this, run by dfs root and will keep the deepest edge on the path from the root to the top with Rv > 1.

Let us remember that we have had requests to reduce Rv. We maintain the closest ancestor of Pv c RPv > 1. We use the idea of compression paths. When answer to a request of the first type will be recalculated Pv. We introduce a recursive function F(v). Which returns the v, if Rv > 1, otherwise perform the assignment of Pv = F(Pv) and returns F(Pv). Each edge we will remove 1 times, so in total the call of all functions F(v) running O(n).

Final time is O(logx) on request of the first type and O(1) an average of request of the second type.

算法思想:

以后补上。

AC代码:


别再手动抓波形了!用Synopsys AXI VIP的Port Monitor自动收集事务数据(附完整连接Scoreboard代码) 当标准Port Monitor无法满足需求时,Synopsys提供的callback机制就像一套精密的手术工具,允许你深入VIP内部进行定制化改造。创建自定义监控点的四步法继承基类// 其他自定义字段...endclass重写目标phase方法// 克隆事务并发送到自定义端口在env中注册callbackcustom_cb);连接自定义端口到分析组件经典应用场景地址phase特定检查数据beat级监控自定义性能统计异常注入检测。 阅读详情

相关推荐

刚入职,软件测试岗,有点迷茫不知道下一步怎么提升自己

软件测试前景和发展都是不错,已经入了软件测试这行业就坚挺下去

大白的博客 2217

c.Labs Codeforces Round #593 (Div. 2)

In order to do some research, n2 labs are built on different heights of a mountain. Let's enumerate them with integers from 1 to n2, such that the lab with the number 1 is at the lowest place, the lab...

天涯沧海的博客 491

父子Agent架构:解决AI系统上下文污染的技术方案

在AI系统设计中,上下文管理是核心挑战之一。传统单Agent架构在处理复杂任务时,常面临上下文无限膨胀导致的信息淹没和性能下降问题。父子Agent架构通过职责分离和上下文隔离机制,采用分而治之的思想,将大任务拆解为多个子任务由专门子Agent处理。该架构中父Agent负责任务规划和结果汇总,子Agent执行具体任务后立即销毁中间状态,通过精炼摘要进行通信。这种设计不仅能有效控制上下文长度,还能提升系统稳定性和执行效率,特别适用于编程辅助、自动化测试等需要多步骤处理的场景。父子Agent架构体现了计算机科学中

weixin_42531710的博客 352

Codeforces Round #593(Div.2.ABC)

优快云的第一篇博客从此篇开始 作为一名小白第一次接近做出了ABC三题,感到很是高兴 接下来是正题: A A题不难,由于第二堆最先会被取完 所以很容易想到贪心的做法: 执行第二种方案,实现用第二堆最少的石头实现最多 执行第一种方案,把第一堆和有可能剩下的第二堆榨干 #include<iostream> using namespace std; int main(){ int...

YeHosea的博客 431

避开这些坑!baostock获取股票数据时最容易犯的5个错误(Python实战)

本文针对使用Python和baostock库获取股票历史数据时常见的五大陷阱,提供了实战解决方案。重点剖析了登录状态验证、参数配置、数据解析、批量操作效率及数据一致性校验等关键环节,帮助开发者构建稳健高效的数据获取流程,避免因细节疏忽导致的数据错误或性能瓶颈。

websocket5live的博客 1439

【VeriStand】从零构建HIL测试平台:核心概念、硬件选型与实战配置指南

本文详细介绍了如何从零构建HIL测试平台,涵盖核心概念、硬件选型与实战配置指南。重点解析了VeriStand生态系统的优势,包括开箱即用特性、与LabVIEW的黄金搭档配合及Python支持。通过实战案例和硬件选型建议,帮助工程师高效搭建可靠的HIL测试平台,提升测试效率与安全性。

weixin_29250573的博客 329

Codeforces Round #593 (Div. 2)

A 暴力计算 #include <bits/stdc++.h> using namespace std; #define endl '\n' int main() { int t; cin >> t; while (t--) { int a, b, c; cin >> a >> b >> c; ...

weixin_40588429的博客 249

(王道计算机组成原理笔记)第一章计算机系统概述-第二节:计算机系统层次结构 1(计算机系统组成、计算机硬件)

文章目录一:冯诺依曼体系结构(1)存储程序计算机(2)层次结构二:计算机硬件概述(1)存储器A:存储元、存储单元、存储体、存储字和存储字长B:MAR 一:冯诺依曼体系结构 在冯诺依曼体系结构中,计算机的硬件主要有**存储器,运算器,控制器,输入和输出设备(也叫做I/O设备)**组成。 (1)存储程序计算机 冯诺依曼体系结构也叫做存储程序计算机,计算器和计算机的唯一区别就是计算器是不能编程的,只能做电路板中设定好的固定的运算。 这也就意味着计算器本质就是一个不能编程的计算机,其在硬件层面已经将逻辑写死,如果

快乐江湖的博客 1万+

Codeforces Round #593——C.Labs(思维题)

题目描述: 题目传送门:https://codeforces.com/contest/1236/problem/C In order to do some research, n2 labs are built on different heights of a mountain. Let’s enumerate them with integers from 1 to n2, such that...

NCWU_Way的博客 415

GTK4 入门到实战

本文介绍GTK4作为主流Linux GUI工具包的发展历程与核心特性,涵盖其从GIMP项目诞生的自由软件理念、版本演进及跨平台支持。重点解析GTK4的架构(GDK/GSK/GLib等)、GObject对象系统、信号-回调机制与事件驱动模型,并以C语言为例,结合开发环境搭建与官方示例(gtk4-demo)指导实践,最终通过图片查看器与多标签编辑器项目实现完整应用开发。

OneSea 1390

gurobi最新下载安装教程 2023.11

我下载的最新版gurobi支持python3.7-python3.11,这个序号与计算机硬件捆绑,一旦激活就会失效。运行激活码之后,产生的。如果既放置在了上面的默认搜索目录,又设置了。系统环境变量(不是用户环境变量),指向保存的目录和文件名(例如。高版本产生的许可文件兼容低版本。验证不会成功,学术许可不会激活。之后cmd进入命令行,cd进入gurobi所在的。,实测不到一小时即可审核完毕,获得对应的许可。如果学校的网关没有将本校的。系统环境变量指向不同的目录和文件,原厂无关,是学校网络的设置问题。

Cachel Wood的博客 2万+

B. Alice and the List of Presents Codeforces Round #593 (Div. 2)

Alice got many presents these days. So she decided to pack them into boxes and send them to her friends. There are n kinds of presents. Presents of one kind are identical (i.e. there is no way to di...

天涯沧海的博客 517

2. 第一个 SAP CDS View 源代码的详细解析:CDS View 和底层自动生成 SQL View 的关系讲解

笔者前一篇教程文章,带着大家在 ABAP 系统创建了一个最简单的基于sflight数据库表的 CDS View:本文对这简单的 14 行源代码背后的知识点进行详细讲解。CDS 全称是 Core Data Services,它是一种数据建模技术,帮助开发者以更直观和高层的方式去描述数据库中所需的数据结构。在一个典型的 SAP ABAP 开发场景里,CDS 经常被用来编写各种用于报表、接口或业务逻辑的数据视图。通常,这些视图包含一系列注解。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1021

Codeforces Round #593 (Div. 2) C. Labs

题目链接 题意:n^2个数,n行n列,每行每个数字比另一行数字大的个数总和的最小值最大。 例如: 在第一次测试中我们可以分开9实验室分组{2,8,5},{9,3,4},{7,6,1}. 从第一组到第二组我们可以传送4水单位(8→3,8→4,5→3,5→4). 从第一组到第三组,我们可以运输。5水单位(2→1,8→7,8→6,8→1,5→1). 从第二组到第一组我们可以传送5水单位(9→...

weixin_44705665的博客 248

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

SAP B1中文培訓教材_SDK

公司内部培训资料,对开发工具 ,DIAPI, UIAPI,Add-ON有详细解说

Codeforces Round #593 (Div. 2) C. Labs

不得不说cf锻炼思维,基础题考思维,实现都很简单 本题题意如下: 给个数n,问你将1~这个数平均分布在n个组中,有两组比较,A组和B组,A组中的每个数和B组中的每个数比较,共有次,若A中某数大于B中某数,则sumAB++,否则sumBA++。然后组比较中min{sum} 现在问你所有分组情况中,最小值最大的分组是什么,可能有多组,只需输出一组即可 分析所有分组情况可知,要使最小值越大...

solego’s blog 254

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Codeforces Round #593 (Div. 2) - D . Alice and the Doll (1236D)

题意:给定一个 n × m 的矩阵,矩阵中有些地方有障碍,一共 k 个障碍,问从坐标 (1,1) 开始,朝向 y 轴,每一次在一个点上至多只能右转一次的情况下,能不能把矩阵中所有没有障碍的点走完(障碍点不能走,点不能重复走); 分析: 这题的条件就相当于让你蛇形走位,看能不能把所有能走的点走完,所以从开始每个方向上走到能走的最远点(边界或者前面有障碍挡着),然后再转一次向; 代码:...

Joker & Liar的博客 179

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

Codeforces Round #640 (Div. 4) E.Special Elements

Codeforces Round #640 (Div. 4) E.Special Elements 题目链接 Pay attention to the non-standard memory limit in this problem. In order to cut off efficient solutions from inefficient ones in this problem, the time limit is rather strict. Prefer to use compiled st

旺崽的博客 1万+

Educational Codeforces Round 83 (Rated for Div. 2) C. Adding Powers

传送门 题意: 思路: 每步可加kik^iki,也可以跳过不加,看能否构成给定数组 数组中的0是不需要处理的 我们直接一步一步把数分解即可,看要用到的i是否够用,每个i只能用一次 做的过程: 假设k=9,有一个数是b[i]=93+94+959^3+9^4+9^593+94+95 int l=0;//要用的幂次 while(1){ while(b[i]%k==0){ b[...

_Alexander的博客 2825

E. Special Elements Codeforces Round 640 (Div. 4)

题目大意:给n个数,特殊的数是其余至少两个位置连续的数的和,问有多少个特殊的数? 思路:暴力双for,注意要用unordered_map去标记,mp会超时。

halation_Z的博客 666

#640(Div.4)E. Special Elements(前缀和)

题目描述 Pay attention to the non-standard memory limit in this problem. In order to cut off efficient solutions from inefficient ones in this problem, the time limit is rather strict. Prefer to use compiled statically typed languages (e.g. C++). If you use P

li_wen_zhuo的博客 942

Codeforces 593 A. 2Char 【Codeforces Round #329 (Div. 2)】

A. 2Char time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Andrew often reads articles in his favori...

weixin_34351321的博客 221

Codeforces Round #329 (Div. 2) 593B - Anton and Lines

题意: 给你n个k和b 就代表n条线段 问你在x1~x2这个区间内这n条线段是否有交点 (边界不算 思路: 这个思路很好想…但是因为很久没写代码….然后一个离散化WA了几次QAQ 顿时想死的心都有了 就是对于每条线段 用一个结构体存x1 x2与线段的交点 如果形成了这种 y1>y3&&y2>y4这种情况就会有交点 先按照左边降序排序,然后看前边的右边是否有比自己的右边小的

humeay的博客 390

Codeforces 593

593 B 题意 给你 \(n\) 条直线(没有与y轴平行的直线),问有没有一个交点在 \((X_1,X_2)\) 内。( \(2 ≤ n ≤ 100000\) ) Examples Input 4 1 2 1 2 1 0 0 1 0 2 Output NO Input 2 1 3 1 0 -1 3 Output YES Input 2 1 3 1 0 0 2 Output YES Input 2...

weixin_30781107的博客 148

【CodeForces 593B --- Anton and Lines】几何

【CodeForces 593B --- Anton and Lines】几何 题目来源:点击进入【CodeForces 593B — Anton and Lines】 Description The teacher gave Anton a large geometry homework, but he didn’t do it (as usual) as he participated in ...

来日浅谈的博客 668

Codeforces 593B Anton and Lines 【思维】【枚举】【排序】

DescriptionThe teacher gave Anton a large geometry homework, but he didn’t do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the

Kadimarx的博客 669

codeforces 593B Anton and Lines

题意:给出n条直线(1<=n<=1e5),问你在(x1,x2)这个区间是否存在交点当n = 1明显没有交点,NO当n = 2: 如下图其中a1为直线L1与x1的交点,b1为直线L1与x2的交点,可以发现如果两条直线要 在(x1,x2)之间相交,那么必须满足a1当n = 3:新博客地址我们发现如果L3与L1在(x1,x2)有交点,那么L3与L2在(x1,x2)必有交点,所以 所以,这种情况,我们只

myHelperIsMe的专栏 939
上一篇: Codeforces Round #328 (Div. 2) (592A,592B,592C,592D)
下一篇: Codeforces Round #330 (Div. 2) (595A,595B(容斥原理))
yphacker
博客等级 码龄12年 199粉丝 540原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值