POJ3604 Professor Ben[线性筛/暴力]

ROS2 Jazzy 学习路线图(2026最新) 摘要: ROS2 Jazzy(LTS版)是2026年长期支持版本,仅适配Ubuntu 24.04。本文提供WSL环境下的学习路线图: 环境搭建(1-2天):配置WSL2+Ubuntu 24.04,安装ROS2 Jazzy及图形工具(VcXsrv、VS Code)。 核心概念(3-5天):掌握节点、话题、服务等通信机制,使用turtlesim和小海龟仿真实践。 开发实战(7-10天):Python/C++节点开发,结合RViz2、Gazebo等工具完成多节点通信和避障项目。 进阶应用(10-15天):导航(N 阅读详情

Professor Ben

  POJ - 3604





 

题意:

给 T 组数据,每组数据含有一个 n,让你求出(d(x)是指 x 的因子个数)


题解:

一看到题目,我们会比较倾向于这样的打表。

void initial()
{
    sum[1]=1;
    for (int i=2 ; i<N ; ++i)
    {
        for (int j=i ; j<N ; j+=i)
        {
            d[j]++;
            sum[j]+=(d[j]+1)*(d[j]+1)*(d[j]+1);
        }
    }
}

然而返回结果,却是一直的TLE,那么显然这样的打表,是行不通的。

我们要更换一下思路,既然这样打表行不通,那么O(n)的线性筛呢?

我们先单独看 只有素因子的数的因子数情况。

例如 4  那么答案是    其中 1 是因子 1 的因子个数,2 是因子 2 的因子个数,3 是因子 4 的因子个数。


可以很容易发现,如果单独是一个素因子构成的数,分解成只有素因子组成的形式,

那么它的结果应该是

再扩展到含有其他素因子组成的数,即这种。


关键就在于,这样子是否成立。我们暂时忽略掉三次方。


实际上,这式子就是算出 当前被分解的这个数 N 的所有因子数的因子个数的和。

其实这式子,更像是单独求 N 的约数个数这样是把全部因子的权值变为1。

而题目要求的是要知道全部因子数的因子个数,所以给他们附上一定的权值 (自己觉得这里讲的有点牵强,可能需要自己理解一下)。

而根据组合来说,就可以很容易说明这式子的合法性。[实在觉得没办法理解合法性,自己手动写几个例如 12 啊 等等之类的合数,然后数学归纳法归纳一下。]

这个式子是成立的话,那么我们就可以用线性筛来打表了,因为我们 每次只需要知道最小素因子的个数,就可以打表了,跟约数个数是一个原理。证明我之前有一篇写线性筛的博客证明过,就不在这里证明了,有兴趣的可以自己找来看看 (OTL本渣渣写的还可能有错误呢,如果发现错误,麻烦帮忙指出来)  线性筛 [约数个数/约数和]


接下来还要处理三次方的问题。

先推荐这篇博客。有一个式子可以求出幂和的,即求

http://blog.miskcoo.com/2014/09/power-sum


有了这个式子,我们可以直接推导出 就是等于 


不想直接打表得到结果的,完全可以先筛全部素数,然后暴力分解 N,然后再用上面的式子得到答案。


====================================================================

这些小细节都知道怎么处理了,我们就可以开始打表了。


下面的各种情况,其实跟打约数个数跟约数和的情况是一直的,了解的话,完全可以自己知道式子就能打出来。因为之前写过一篇线性筛的博客,就懒得写的那么详细了。

sum[i]就是 i 的结果

num[i]就是 i 的最小素因子的个数


① n 是素数

那么结果显然是就是 (1+8) 就是说只有自己本身跟 1 这两个因子数,而本身的因子个数为 2。

记录下最小素因子个数。

sum[i]=1+8;

num[i]=1;


② i % prim[j] != 0

因为前面  i 中不存在 prim[j] 这个素因子,但是 i*prim[j] 中存在 prim[j] 这个素因子。

因此结果应该是 sum[i*prim[j]] = sum[i]*sum[prim[j]]

记录下当前最小素因子个数 num[i*prim[j]] = 1 

(因为每次扫的必然是最小素因子,至于为什么,本身线性筛就是被最小素因子筛出来的)


③ i % prim[j] == 0

而这种情况,i 中包含了 prim[j] 这个素因子,意味着在最小素因子的那一项,会多了一项

即成了

原本的 i 应该是

那么为了得到 i*prim[j] 的结果

我们需要 将 sum[i] /  * 

那么就需要用到我们之前记录下的最小素因子个数,来得到这个结果。

最后结果 sum[i*prim[j]] = sum[i] / s3(num[i]+1) * s3(num[i]+2)  [s3 是用来求的函数]

继续记录下最小素因子个数 num[i*prim[j]] = num[i] + 1


打表结束,我们就可以得到我们需要的答案了。

要说明一下,这个题的内存卡的有点严,如果再开一个数组就会 MLE 所以我没有直接再开一个数组来保存最小素因子那一项的和,而是直接用公式求出。


[OTL 再一次知道线性筛的厉害啊]


打表

#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
const int N=5e6+5;
int prim[N],num[N],sum[N];
bool mark[N];
int cnt;
int s3(int x)
{
    return (x+1)*(x+1)*(x+2)*(x+2)/4;
}
void initial()
{
    cnt=0;
    sum[1]=1;
    for (int i=2 ; i<N ; ++i)
    {
        if (!mark[i])
        {
            prim[cnt++]=i;
            num[i]=1;
            sum[i]=9;
        }
        for (int j=0 ; j<cnt && i*prim[j]<N ; ++j)
        {
            mark[i*prim[j]]=1;
            if (!(i%prim[j]))
            {
                num[i*prim[j]]=num[i]+1;
                sum[i*prim[j]]=sum[i]/s3(num[i])*s3(num[i*prim[j]]);
                break;
            }
            sum[i*prim[j]]=sum[i]*sum[prim[j]];
            num[i*prim[j]]=1;
        }
    }
}
int main()
{
    initial();
    int T;
    scanf("%d",&T);
    while (T--)
    {
        int n;
        scanf("%d",&n);
        printf("%d\n",sum[n]);
    }
    return 0;
}

暴力分解

#pragma comment(linker, "/STACK:102400000,102400000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<string>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
using namespace std;
typedef long long ll;
const int N=1e4+5;
bool mark[N];
int prim[N];
int num[N];
int cnt;
void initial()
{
    cnt=0;
    for (int i=2 ; i<N ; ++i)
    {
        if (!mark[i])
            prim[cnt++]=i;
        for (int j=0 ; j<cnt && i*prim[j]<N ; ++j)
        {
            mark[i*prim[j]]=1;
            if (!(i%prim[j]))
                break;
        }
    }
}
ll divi(int n)
{
    int k=0;
    ll ans=1;
    for (int i=0 ; i<cnt ; ++i)
    {
        if (prim[i]*prim[i]>n)
            break;
        if (!(n%prim[i]))
        {
            int ch=0;
            while (!(n%prim[i]))
            {
                ch++;
                n/=prim[i];
            }
            ans*=(ch+1)*(ch+1)*(ch+2)*(ch+2)/4;
        }
    }
    if (n>1)
        ans*=(1+8);
    return ans;
}
int main()
{
    initial();
    int T;
    scanf("%d",&T);
    while (T--)
    {
        int n;
        scanf("%d",&n);
        printf("%lld\n",divi(n));
    }
    return 0;
}


期货缠论实战:文华财经笔中枢指标公式解析与博易大师应用指南 本文深入解析期货缠论实战中的文华财经笔中枢指标公式及其在博易大师平台的应用技巧。详细介绍了笔中枢指标的核心逻辑、公式拆解、参数设置及多周期联合作战策略,帮助交易者提升市场分析能力与交易胜率。特别适合期货交易者学习缠论指标的实际应用。 阅读详情

相关推荐

自动驾驶开发者必看:nuscenes数据集23类物体标注全解析(附避坑指南)

本文深入解析nuscenes数据集的23类物体标注系统,为自动驾驶开发者提供全面的标注规范解读和实战避坑指南。涵盖多模态数据组织、类别细分规则、属性系统应用技巧以及标注质量验证方法,帮助开发者高效利用这一标杆数据集提升模型性能。

weixin_29041767的博客 261

POJ 3604 Professor Ben

这题的大意就是 给出一个数n, 找到它所有的因子, 然后把这些(因子的因子数)的立方和求出来。 题目的时限虽然很宽,但是数据很BT。首先,公式必须找出来。 证明如下: 先将n质因数分解成形如n = a ^m * b ^ p * c ^q *........; 那么要求的结果为函数g(x)的值; 我们以n有2个质因数为例子; g(n) = g(a ^m  *  b ^p ) ; 设求因

水 2010

Windows 11 RDP Wrapper 配置教程与常见问题解决方法

解锁家庭版RDP主机功能(Windows 11家庭版原生不支持作为RDP服务器)突破单用户连接限制,实现多用户同时远程登录(类似服务器版功能)它不修改系统核心文件,通过注入方式工作,相对安全可靠。RDP Wrapper是Windows 11家庭版用户启用远程桌面、突破单用户限制的高效工具。遵循本文步骤可快速完成配置,遇到问题时按常见问题排查方案逐一解决,多数问题可通过更新配置文件或重启服务解决。若长期使用,建议关注官方GitHub仓库的更新,确保兼容性和安全性。

weixin_41521681的博客 1427

POJ 3604 Professor Ben(合数唯一分解,筛法素数表)

这题的大意就是 给出一个数n, 找到它所有的因子, 然后把这些(因子的因子数)的立方和求出来。 题目的时限虽然很宽,但是数据很BT。首先,公式必须找出来。 证明如下: 先将n质因数分解成形如n = a ^m * b ^ p * c ^q *........; 那么要求的结果为函数g(x)的值; 我们以n有2个质因数为例子; g(n) = g(a ^m  *  b

code_or_code 953

某手 v8.x 签名计算方法(二) sig和__NS_sig3

一、目标 今天的目标是 sig和__NS_sig3,咱们抓个包先 二、步骤 sig目测像是MD5 先jadx搜索 sig= ,没有找到结果。 再试试 sig ,晕倒 6k多个结果,突然灵光一闪,这些参数,必然是要加入到 Map中,那么我们搜索 "sig" 应该就是这个 CPU.getClock,Hook之 var signCls = Java.use('com.yxcorp.xxx.util.CPU'); signCls.getClock.implementation = function(a,b,c

fenfei331的博客 2435

保姆级教程:用K210麦克风阵列模块实现声源定位(附完整Python代码与坐标计算)

本教程详细介绍了如何使用K210麦克风阵列模块实现高精度声源定位,包括硬件连接、算法解析与实战代码。通过Python代码示例,展示了从原始数据获取到三维空间坐标计算的完整流程,适用于智能家居、机器人导航等场景。

weixin_42558093的博客 233

poj3604

题意:对于n的每个约数a,设a的约数个数为b,求所有b^3的和。 分析:我们可以试想,对于一个整数n=a^k(a是质数)n的约数个数一定是k+1,这些约数是a^0,a^1,a^2……。而我们发现每个约数仍然是a^k的形式,所以每个约数的约数个数一定为ki+1(对于约数a^i)。所以约数个数序列应该为1,2,3,4,5……k+1。而对于这个n本题所求的结果一定为1^3,2^3……(k+1)^3。用...

weixin_33889245的博客 132

通过声音识别鸟类

根据野生鸟类的外表来识别它是一回事。仅仅根据声音来识别同一只鸟是另一回事。除非你是一个熟练的观鸟者,通过声音识别鸟类可能相当具有挑战性德国马尔堡大学的一组数学、计算机科学和生物学研究人员设计了一种快速识别鸟类和监测当地生物多样性的方法。他们使用连接到 NVIDIA 的便携式设备拍摄的录音根据研究人员的说法是一个边缘人工智能系统,“基于分布式系统中运行的嵌入式边缘设备,能够对森林中记录的声景进行高效、连续的评估。”要了解更多信息,请参阅。

分享AI前沿科技 1682

poj 3604 Professor Ben 因子

题意:输入一个数n,它的因子为ai,对于每个ai,bi表示ai的因子数。现在求的是∑bi^3。 题解:对于一个数n,可以分解质因数,得到n=p1^t1*p2^t2...*pk^tk(pi为素数)。则因子就是第pi的指数,取(0~ti)中的一个数,共(1+t1)*(1+t2)*...*(1+tk)个因子。对于其中一个因子m=p1^c1*...*pk^ck,则bm=(c1+1)^3*...*(ck+

冷月之殇 857

PyTorch深度学习实战(3)——使用PyTorch构建神经网络

PyTorch 是一个用于构建深度神经网络的库,具有灵活性和可扩展性,可以轻松自定义模型。在本节中,我们将使用 PyTorch 库构建神经网络,利用张量对象操作和梯度值计算更新网络权重,并利用 Sequential 类简化网络构建过程,最后还介绍了如何使用 save、load 方法保存和加载模型,以节省模型训练时间。

盼小辉丶的博客 8万+

Sprd Android 13 备忘 OTA升级app没更新到目标版本,恢复出厂才生效修改这个值

【代码】Sprd Android 13 备忘 OTA升级app没更新到目标版本,恢复出厂才生效修改这个值。

m0_60898338的博客 683

poj-3604(数论+推导)

问题描述:Professor Ben is an old stubborn man teaching mathematics in a university. He likes to puzzle his students with perplexing (sometimes boring) problems. Today his task is: for a given integer N, a...

wust_cyl的博客 540

YOLO26涨点改进 | 独家创新,特征融合改进篇 | TGRS 2025 | 引入FFM特征融合模块,实现特征的全局交互与融合,含多种组合创新改进,适合小目标检测、助力YOLO26有效涨点

本文提出了一种改进YOLO26目标检测模型的FFM模块,该模块通过跨模态注意力机制实现全局特征融合,显著提升模型对小目标、密集目标和复杂场景的检测性能。FFM采用多头跨注意力机制建模不同模态间的复杂关系,同时引入可调节下采样率降低计算复杂度。实验表明,在WHU-OPT-SAR等数据集上,FFM模块使mIoU提升0.75%,OA提升0.32%。文章详细介绍了FFM的结构原理、核心代码实现,并提供了两种改进YOLO26的yaml配置文件方案,包括FFM单独使用以及与FCM模块的组合方案。

Ai缝合怪、助力小伙伴高效发论文 200

poj 3604 Professor Ben 组合计数

题意: 给一个数n,设它有因子a1,a2,a3..am,每个因子a[i]的因子个数为bi,求sum(b1^3+b2^3+...b^m)。 思路: 用到两个公式sum(1^3+2^3...k^3)==(k*(k+1)/2)^2,设n=x1^y1*x2^y2...xt^yt,那么n的因子个数(y1+1)*(y2+1)...*(yt+1).设T(x)==1^3+2^3+..x^3,结果为T(y1+

sepNINE的专栏 738

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

SAP B1中文培訓教材_SDK

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

POJ - 3604 Professor Ben

题目:给出一个N,有若干的因子,求出因子的因子个数立方和 思路:令N=p1^a1*p2^a2*...*pn^an 那么答案为(1^3+2^3+...+a1^3)*(1^3+2^3+...+a2^3)*.... 代码: #pragma comment(linker, "/STACK:1024000000,1024000000") #include #include #include #inc

ACVevtor的博客 389

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

线性筛 [约数个数/约数和]

刚才手动推了一下 用线性筛筛约数个数和约数和,就顺便写篇博客记录一下。不过网上应该也有不少人推过了。

ControlBear的博客 1万+

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

SGU106 The equation[扩展欧几里德算法]

A - The equation Time Limit:250MS     Memory Limit:4096KB     64bit IO Format:%I64d & %I64u Submit Status Description There is an equation ax + by + c = 0. Given a,b,c,x1,x2,

ControlBear的博客 1430

HDU5768 Lucky7[中国剩余定理+容斥定理]

E - Lucky7 Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Description When ?? was born, seven crows flew in and stopped beside him. In its c

ControlBear的博客 1328

HDU5663 Hillan and the girl[莫比乌斯反演]

U - Hillan and the girl  HDU - 5663 题意: 给T组数据,每组数据有一个n和一个m,求,其中 题解: 我们反过来,先求出 gcd(i,j) 是平方数的组合个数,因为感觉这个更好算,然后用 n*m 减去这些个数就是答案了。 设 f(x) 为 gcd(i,j)=x 的个数 F(x)

ControlBear的博客 921

LightOJ1028 1090 1138 Trailing Zeroes (I)(Ⅱ)(Ⅲ)[算数基本定理/打表/打表+二分]

C -  Trailing Zeroes (I) Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Description We know what a base of a number is and what the prop

ControlBear的博客 918

HDU5733 tetrahedron[计算几何]

K - tetrahedron Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 5733 Description Given four points ABCD, if ABCD is a tetrahed

ControlBear的博客 884

BZOJ2818 Gcd[莫比乌斯反演]

E - Gcd  HYSBZ2818 BZOJ2818 题解: 首先根据题意,设 f(i) 为 gcd(x,y)=i 的对数。 对应的设( d=k*j [k>=1]   因为总是忘记整除左大还是右大) F(j)我们可以很容易求出来,就是,因为 F(j) 代表在 n 里面所有 gcd(x,y)=i 其中 i 是 j 的倍数的所有情况。

ControlBear的博客 835

HDU6030 Happy Necklace[矩阵快速幂]

Happy Necklace  HDU - 6030   题意: 小Q要弄一条项链给女朋友,而弄这条项链的要求,就是要每素数长度里,红色的珠子的个数都不能少于蓝色珠子的个数(就是说红色个数小于等于蓝色个数),然后给你n个珠子(红色蓝色都可以),问弄成符合这样条件的一条项链,能有多少种方案。 题解: 要保证每个素数长度都符合这个条件

ControlBear的博客 742

HDU5446 Unknown Treasure[中国剩余定理+Lucas]

J - Unknown Treasure  HDU - 5446  题意: T组数据, 给你n,m,k ,接下来给你k个素数 求C(n,m)%(这k个素数的积) 题解: 题目给我的M 是由(p1*p2*...*pk)组成的,给我的第一反应是中国剩余定理. 那么照着这个方向,我们就必须得得到同余式. 我们的同余式则是又 x%pi=ai  那么我们的x

ControlBear的博客 699

HDU2152 Fruit[母函数/背包]

B - Fruit  HDU - 2152

ControlBear的博客 687

HDU6050 Funny Function[矩阵快速幂]

F - Funny Function   题意: 给出一个函数由题目给的公式可以求出其他项,给出一个n和m,根据这个求出。结果取模1e9+7 题解: 根据前几项 1  1  3  5  11  21  43  85  171  341  683  ......

ControlBear的博客 635
上一篇: LightOJ1052 String Growth[矩阵快速幂]
下一篇: HDU5663 Hillan and the girl[莫比乌斯反演]
ControlBear
博客等级 码龄11年 34粉丝 51原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值