AtCoder | ARC064 | 题解

AtCoder ABC336 A-D题解 AtCoder ABC336 题解 阅读详情

ARC064

感觉这场还是挺简单的(但这并不影响我仍然不会做QwQ

E E E题感觉啥都想到了。…知道要去求最短路…但却没有想到dij…???(smg

C. Boxes and Candies

肯定是尽量改 [ 2 , n − 1 ] [2,n-1] [2,n−1]的嘛…所以你就一遍扫下来就行啦呀

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 1e5 + 10;
ll a[N];

int main() {
	int n, x;
	cin >> n >> x;
	for(int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
	}
	ll pos = 0;
	for(int i = 2; i <= n; ++i) {
		ll gg = max(0ll, (a[i] + a[i - 1]) - x);
		a[i] -= min(a[i], gg);
		pos += gg;
	}
	printf("%lld\n", pos);
	return 0;
}
D.An Ordinary Game

可以发现

  • 如果头和尾是相同的话 假设这么一个串 a b a b a ababa ababa( b b b可以为任意字符)

    那么长度为奇数的话必败

  • 如果头和尾不相同 那么这么一个串 a c a c acac acac( a , c a,c a,c也可以为任意字符)

    那么长度为偶数的话必败

#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
char lx[N];

int main() {
	scanf("%s", lx + 1);
	int len = strlen(lx + 1);
	if(lx[1] == lx[len]) {
		if(len & 1) printf("Second\n");
		else printf("First\n");
	} else {
		if(len & 1) printf("First\n");
		else printf("Second\n");
	}
	return 0;
}
E.Cosmic Rays

把每一个圆当作一个点 (圆和圆之间的距离是圆心距离-半径和 和 0 0 0取个max就行啦)

然后你跑一遍最短路就行了

#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
const double inf = 1e-12;
struct Point {
	double x, y;
} c[N];
int vis[N];
double R[N], f[N];

double pf(double x) {
	return x * x;
}

double dis(Point A, Point B) {
	return sqrt(pf(A.x - B.x) + pf(A.y - B.y));
}

double get(int k, int j) {
	return max(0.0, dis(c[k], c[j]) - (R[k] + R[j]));
}

int main() {
	for(int i = 1; i <= 2; ++i) {
		scanf("%lf%lf", &c[i].x, &c[i].y);
		R[i] = 0;
	}
	int n;
	scanf("%d", &n);
	n += 2;
	for(int i = 1; i <= n; ++i) f[i] = 3e9;
	for(int i = 3; i <= n; ++i) {
		scanf("%lf%lf%lf", &c[i].x, &c[i].y, &R[i]);
	}
	f[1] = 0;
	for(;;) {
		int be = -1;
		for(int i = 1; i <= n; ++i) {
			if(vis[i]) continue;
			if(be == -1 || f[be] > f[i]) be = i;
		}
		if(be == -1) break;
		vis[be] = 1;
		for(int i = 1; i <= n; ++i) {
			f[i] = min(f[i], f[be] + get(i, be));
		}
	}
	printf("%.12f\n", f[2]);
	return 0;
}
F.Rotated Palindromes

我们设 f [ i ] f[i] f[i]表示长度为 i i i且没有长度大于1的循环节的回文串个数

那么显然 f [ i ] = k ⌈ i 2 ⌉ − ∑ d ∣ i f [ d ] f[i]=k^{\lceil{\dfrac{i}{2}}\rceil}-\sum_{d|i}f[d] f[i]=k⌈2i​⌉−∑d∣i​f[d]

由于每次你只需要根号级别复杂度…所以这个可以很快处理出来

那么最后的 a n s = ∑ d ∣ n [ d &amp; 1 ] ∗ d ∗ f [ d ] + [ ! ( d &amp; 1 ) ] ∗ d 2 ∗ f [ d ] ans=\sum_{d|n}[d\&amp;1]*d*f[d]+[!(d\&amp;1)]*\dfrac{d}{2}*f[d] ans=∑d∣n​[d&1]∗d∗f[d]+[!(d&1)]∗2d​∗f[d]

因为长度为偶数时 移到一半的时候就会开始重复 所以要除以2

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1e9 + 7;
int n, k;
map<int, ll> f;

ll add(ll x, ll y) {
	return (x + y + mod) % mod;
}

void Add(ll &x, ll y) {
	x = (x + y + mod) % mod;
}

ll mul(ll x, ll y) {
	return (x * y) % mod;
}

void Mul(ll &x, ll y) {
	x = (x * y) % mod;
}

ll q_pow(ll x, int y) {
	ll ans = 1;
	for(; y; y >>= 1) {
		if(y & 1) Mul(ans, x);
		Mul(x, x);
	}
	return ans;
}

ll get(int x) {
	if(!f.count(x)) {
		int len = sqrt(x);
		ll pos = q_pow(k, (x / 2) + (x & 1));
		for(int i = 2; i <= len; ++i) {
			if(x % i) continue;
			Add(pos, -get(i));
			if(i * i != x) Add(pos, -get(x / i));
		}
		if(x != 1) Add(pos, -k);
		return f[x] = pos;
	} else return f[x];
}

int main() {
	scanf("%d%d", &n, &k);
	int len = sqrt(n);
	ll ans = 0;
	for(int i = 1; i <= len; ++i) {
		if(n % i) continue;
		if(i & 1) Add(ans, mul(i, get(i)));
		else Add(ans, mul(i / 2, get(i)));
		if(i * i != n) {
			int now = n / i;
			if(now & 1) Add(ans, mul(now, get(now)));
			else Add(ans, mul(now / 2, get(now)));
		}
	}
	printf("%lld\n", (ans + mod) % mod);
	return 0;
}

本文作者:Averyta

博客地址:https://blog.youkuaiyun.com/AngryVegetable

AtCoder Beginner Contest 172 E - NEQ(二项式反演) AtCoder Beginner Contest 172 E - NEQ 题意: 求满足下列条件的长度为 NNN且包含 [1,M][1, M][1,M]范围内整数的序列 A1,A2,⋯ ,ANA_1, A_2, \cdots, A_NA1​,A2​,⋯,AN​及 B1,B2,⋯ ,BNB_1, B_2, \cdots, B_NB1​,B2​,⋯,BN​组成的序列对数量。 ∀1≤i<j≤N,  Ai≠Aj∧Bi≠Bj\forall 1 \le i \lt j \le N, \; A_i \neq A_ 阅读详情

相关推荐

AtCoder Beginner Contest 200 题解

A.B比较简单,题解就不放了,主要想说下C的几种做法 C-Ringo’s Favorite Numbers 2 题目链接 本题我在比赛中用的是类似埃氏筛的思想,用一个vis[]数组来标记。但是赛后看队友的做法和editorial提供的做法时,感觉有所启发,故记录一下,感觉还蛮有意思的,主要想分享一下一步步优化的过程。具体做法见我的代码。 #include<bits/stdc++.h> using namespace std; /* //1.法1:埃氏筛的思想,我的做法,核心是统计每一类的个数,然

bogedaye的博客 1054

AtCoder Regular Contest 064 ,D An Ordinary Game(博弈,一定会产生某种结果)

题目描述: D - An Ordinary Game Time Limit: 2 sec / Memory Limit: 256 MB Score :500500points Problem Statement There is a stringssof length33or greater...

又菜又爱玩 315

Mybatis Provider注解实现批量插入

需求 借助mybatis 的provider实现一个比较通用的,批量插入数据接口。 Mapper接口 第一参数为需要批量插入的数据,第二个参数为对应实体类的class public interface BaseDao<T> { @InsertProvider(type = BaseProvider.class, method = "batchInsert") int batchInsert(@Param("lists") List<T&gt

小楼夜听雨的博客 2417

AtCoder题解集锦

AtCoder题解集锦 自己从全网整理的一些优质AtCoder题解,目前只有ABC(AtCoder Beginner Contest)的C~F。不定期更新。 如您有更多需求,欢迎私信我或在评论区留言! 用法 表格查找 找到对应比赛的行 找到对应题目的列 该位置即为对应的题解 题号查找 在浏览器中按下搜索快捷键Ctrl+F,调出搜索窗口。 输入对应的题号,如244F 找到对应题解 标题查找 在浏览器中按下搜索快捷键Ctrl+F,调出搜索窗口。 输入题目标题,如Shortest Good

天生我材必有用,千金散尽还复来。 1万+

基于gem5模拟trace的cache模拟器的实现

在做计算机体系结构的时候,模拟器是一个重要且又有效的工具。其中gem5集成了gem和m5的优点,使用起来比较简单和方便。其中包括了se模式和fs模式,se模式是在gem5运行我们已经编译好的程序,可以获取cache,cpu状态等数据,fs模式下可以模拟操作系统,我们可以将我们自己修改的linux内核加载到哥们上运行。下面介绍了使用gem5的se模式,运行编译好的ARM可执行文件。获取访存的trac

gaoxiang的专栏 8891

保姆级教程:用NovAtel Inertial Explorer 8.7搞定GNSS/INS紧组合后处理(附避坑指南)

本文提供NovAtel Inertial Explorer 8.7的GNSS/INS紧组合后处理全流程教程,涵盖环境准备、数据转换、基站坐标解算及紧组合处理等关键步骤。特别针对零基础用户,分享实用技巧和常见陷阱,帮助高效完成高精度组合导航数据处理,适用于测绘、自动驾驶等领域。

weixin_42614269的博客 280

AtCoder Beginner Contest 288题解(A-G)

AtCoder Beginner Contest 288题解(A-G)

weixin_64008869的博客 1230

杰理JL701N V142的SDK实现双备份自定义OTA教程和代码分享

摘要 本文档详细介绍了基于JL701N SDK的UART OTA升级功能开发方案。该方案采用双备份(Dual Bank)机制,通过串口实现安全可靠的固件远程更新。核心特性包括:1) 双备份升级机制确保升级失败可回滚;2) CRC-16/XMODEM校验保障数据完整性;3) 灵活的传输控制,支持自定义波特率和数据包大小。文档提供了完整的系统架构、API接口说明、通信协议规范以及移植指南,适用于生产烧录、现场升级等多种场景。配套Python升级工具简化了升级流程,使开发人员能够快速实现固件更新功能。

qq_42014563的博客 275

AtCoder Beginner Contest 214 G. Three Permutations(组合数学 容斥 背包 二项式反演)

剩下n-i个随便选(可能冲突),乘以n-i的阶乘,转化成至少冲突i次的方案数。1. 如果选了(1,n),对应长为n-2的链上选k-1对匹配的方案,在新环上:则认为是在长度为2*n的环上,选择一对相邻的点两两匹配,剩下的随便选,转化成至少冲突k次的方案数,利用二项式反演解决。2. 如果没选(1,n),对应长为n的链选k对匹配的方案,暴力合并背包,得到恰好选了i个冲突的点的方案数,由于原来长为n的环变为新的长为2n的环,考虑容斥,算恰好冲突的k次的方案数,对于环来说,一个长为n的环,

小衣同学的博客 546

RT-DETR改进策略【卷积层】| ECCV-2024 小波卷积WTConv 增大感受野,降低参数量计算量,独家创新助力涨点

本文记录的是利用模块优化的目标检测网络模型。的目的是在不出现过参数化的情况下有效地增加卷积的感受野,从而解决了在感受野扩展中的参数膨胀问题。本文将其加入到深度可分离卷积中,有效降低模型参数量和计算量,并二次创新,使模块更好地捕捉低频特征,增强网络性能。Wavelet Convolutions for Large Receptive Fields小波卷积及其改进的实现代码如下: 四、创新模块 4.1 改进点1⭐ 模块改进方法:加入(第五节讲解添加步骤)。添加后如下:模块改进方法:基于的(第五节讲解添加步骤)

Limiiiing的博客 1503

8.DJI-PSDK:一站式项目功能开发总结(空中气象站项目/激光甲烷检测项目)

本文将以一篇文章的幅度快速完成: 项目一:空中气象站项目; 项目二:激光甲烷项目; 项目所使用的PSDK来源于第0章节末尾的百度网盘;解压:Payload-SDK-3.8.zip代码所在目录:双击打开: 修改打印串口和相关波特率,我们修改如下: 进行相关编译选项配置如下: :

哒宰的博客 294

ATCODER ABC C题解

set_target_properties(mypass1 PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) #---->修改 项目名称。set(LLVM_DIR "D:/LLVM/llvm-project/build/lib/cmake/llvm")#---->修改 llvm cmake配置路径。target_compile_options(mypass1 PRIVATE /utf-8)#---->修改 项目名称,文件名。

sFi7abSRK的博客 186

计算机组成原理(第三版)唐朔飞-第五章输入输出系统-课后习题

计算机组成原理(第三版)唐朔飞-第五章输入输出系统-课后习题

weixin_45735391的博客 6万+

AtCoder整理(持续更新中……)

做了那么久的atcoder觉得自己的题解发的很乱 给有想和我一起交流atcoder题目(或者指出我做法的很菜)(或者指责我为什么整场比赛只会抄题解)的同学一个索引的机会??? 于是写了个爬虫爬了下 AtCoder整理 AGC 【AtCoder】AGC034 【AtCoder】AGC033 【AtCoder】AGC032 【AtCoder】AGC031 【AtCoder】AGC030 【A...

weixin_30364147的博客 330

【腾讯小龙虾WorkBuddy专栏04】一文搞懂WorkBuddy的「专家」和「专家团」

WorkBuddy专家与专家团:专业级AI协作解决方案 WorkBuddy的专家(Expert)与专家团(Expert Team)功能颠覆了通用AI的局限性,提供角色化、可交付的专业服务。 核心优势 专家:深度垂直领域的AI顾问,具备人设、方法论、工具链,如全栈开发专家能直接交付完整项目,而非代码片段。 专家团:多智能体协作,自动拆解复杂任务(如竞品分析、全栈开发)并分发给对应角色,并行执行后整合输出,效率提升显著。 使用场景 单专家:解决专业问题(如SQL优化、UI设计)。

AI人人懂 2019

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

AtCoder Regular Contest

一句话题解 因为上篇AGC的写的有点长……估计这篇也短不了所以放个一句话题解方便查阅啥的吧QwQ 具体的题意代码题解还是往下翻…… ARC 058 D:简单容斥计数。 E:用二进制表示放的数字,然后状压$DP$。 F:$biset$优化$DP$预处理,乱搞贪心。 ARC 059 D:傻题,存在长的合法子串就一定会存在短的。 E:前缀和优化$DP$。 F:每个长度为$len$的串...

weixin_34150503的博客 1225

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

ARC 刷题记录 · 壹 | 错题本

文章目录10.22[ARC058B] Iroha and a Grid[ARC058C] Iroha and Haiku[ARC059C] Children and Candies[ARC059D] Unhappy Hacking 标红的表示看了题解。 10.22 [ARC058B] Iroha and a Grid 简单计数题,总方案减不合法的即可,不合法的可以枚举 A×BA \times BA×B 的矩形的一个对角线计算。 #include <bits/stdc++.h> const in

ixRic 540

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

深度学习工具包 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")

[AtCoder ARC077 .F] [字符串] [乱搞] SS

翻译下题解…可以发现一次变化是f(SS)=STSTf(SS)=STST,其中TT是S的一个前缀,|T||T|是S的最小周期 那么我们就只需要考虑变化g(S)=STg(S)=ST,因为不断变化1010010^{100}次的话,后面的部分就可以省去设TT的长度为dd,SS的长度是nn 可以证明如果d|nd|n,那么g(ST)=STTg(ST)=STT 否则,g(ST)=STSg(ST)=STS那么

CE玩家 1061

AtCoder - 2154 Cosmic Rays

E - Cosmic RaysTime limit : 2sec / Memory limit : 256MB Score : 600 pointsProblem StatementOn the xy-plane, Snuke is going to travel from the point (xs,ys) to the point (xt,yt).He can move in arbitra...

PinesL 503

atcoder:Tokio Marine & Nichido Fire Insurance Programming Contest 2020:E - O(rand)(位运算+二项式反演)

题目大意:从 N 个数字中选 1 到 k 个,使得这些数字的与运算结果为 s, 或运算结果为 t,为有多少种选择方案。 首先我们只关注 集合a 中满足 (x & s) == s && (x & t) == x 的元素 x,称这个集合为 X:{x},令 t = t ^ s,通过预处理,将 t 中为 1的位提出来,此时问题等价于:s = 0, t = 2L−12^L - 12L−1。 这相当于要从集合 X 中选出 [1,k] 个元素作为一个新的集合,使得这个新集合中在这 L .

qq_41997978的博客 914

AtCoder Beginner Contest 324题解(F,G)

为了让移除大于某个数操作的erase操作最少,可以用两个set以对顶堆的形式维护中位数,若给定数大于中位数,则把原序列不断弹出最大的,若小于中位数,则交换两序列位置,不断弹出最小的元素给原序列的位置。题意:给定一个1-N的排列作为序列0,然后不断从此前某个序列中要么移除第k个元素之后的所有元素组成新序列,要么移除大于某个数的所有元素构成新序列。原操作相当于对序列不断的分拆,我们倒过来考虑对序列不断的合并,而且总让序列短的合并进序列长的,被合并的元素由于每次合并后所在序列长度增加一倍,最多被合并。

weixin_44589861的博客 248

ABC 321 A-F

ABC321

qq_73994342的博客 446

Atcoder AGC002 题解

A - Range Product 如果区间包含0就输出Zero,如果负数的个数是奇数个就输出Negative,否则输出Positive #include&lt;bits/stdc++.h&gt; using namespace std; #define RI register int int a,b; int main() { scanf("%d%d",&amp;a,&amp;b); if(...

litble的成(tui)长(fei)史 742
上一篇: 算法 | 动态dp学习笔记 | 未完待更
下一篇: 一些题解的传送门qwq
Averyta
博客等级 码龄7年 1粉丝 16原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值