HDU 2601 An easy problem(求因数)

ESP32 开发实战:VS Code 头文件波浪线及编译错误的终极解决方案 本文针对ESP32开发者在VS Code中常见的头文件红色波浪线和fatal error编译错误,提供了终极解决方案。通过详细讲解如何配置c_cpp_properties.json文件来修复编辑器智能提示,以及如何修改CMakeLists.txt来修正编译器路径,帮助开发者彻底解决环境配置问题,提升开发效率。 阅读详情

An easy problem

Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 10006    Accepted Submission(s): 2511


Problem Description
When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan buy 100 pig” .etc..

One day Teddy met a old man in his dream , in that dream the man whose name was“RuLai” gave Teddy a problem :

Given an N , can you calculate how many ways to write N as i * j + i + j (0 < i <= j) ?

Teddy found the answer when N was less than 10…but if N get bigger , he found it was too difficult for him to solve.
Well , you clever ACMers ,could you help little Teddy to solve this problem and let him have a good dream ?
 

Input
The first line contain a T(T <= 2000) . followed by T lines ,each line contain an integer N (0<=N <= 10 10).
 

Output
For each case, output the number of ways in one line.
 

Sample Input
  
2 1 3
 

Sample Output
  
0 1
 

Author
Teddy
 

Source

题意:
给出一个N,求出使等式 i×j+i+j=N 成立的i j的个数 (0 < i <= j)。

point:
 i * j + i + j =N   
  i*(j+1)+j=N 
  i*(j+1)+j+1=N+1 
(i+1)(j+1)=N+1-------X*Y=N+1
题目便转化为,求N+1的非1非自身因数有几个,且 (1 < X <= Y)

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <algorithm>
using namespace std;
#define ll long long
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        ll n;
        scanf("%lld",&n);
        int ans=0;
        ll m=sqrt(n+1);
        for(int i=2;i<=m;i++)
        {
            if((n+1)%i==0)
                ans++;
        }
        printf("%d\n",ans);
    }

    return 0;
}



 
农业无人机:无人机图像处理_(8).遥感图像处理与分析 遥感图像处理与分析在农业无人机技术中具有重要作用,通过图像预处理、特征提取、分类与分割、目标检测等技术,可以实现对农田的精细管理、作物监测、病虫害预测等应用。本节详细介绍了这些技术的基本概念、常用方法和具体实现,希望对您在农业无人机图像处理方面的学习和应用有所帮助。 阅读详情

相关推荐

【无标题】 Python自动化法律文书撰写

Jinja2是一个功能强大的模板引擎,支持丰富的语法和功能。除了条件判断和循环语句外,Jinja2还支持过滤器、宏、继承等高级特性,非常适合处理复杂的文书模板。

master_chenchen的博客 2062

hdu 2601 An easy problem

hdu   2601   An easy problem           题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2601 题目大意:计算满足i * j + i + j (0 这个式子的i、j共有多少对。 题目分析:上式可以等价于(i+1)*(j+1)==N+1。从2开始找,上界是sqrt(N+1),只要(N+1)能被当前i整除,计

slicer的技术交流栈 830

去面试游戏测试工程师,面试官看着我的简历呆住了

!我个人整理了我这几年软件测试生涯整理的一些技术资料,包含:电子书,简历模块,各种工作模板,面试宝典,自学项目等。欢迎大家点击下方名片免费领取,千万不要错过哦。

MXB1220的博客 7327

求约数 hdu2601 An easy problem

这题有两种方法,一种是直接sqrt(n)的复杂度求约数数量 还有一种当然是比较快的方法,通过质因数分解求约数数量 为什么是求约数数量呢 可以发现 n+1=(i+1)*(j+1)  所以我们只需要求出约数的数量,就能知道i+1有多少种情况了,然后还需要讨论一下 假如n是12,约数有1,2,3,4,6,12 那么,因为是偶数个约数,所以总是两两配对的,一共有3对,所以i+1可能为1

qwb的博客 1087

STM32 CubeMX实战:手把手教你用I2C驱动IST8310磁力计(附完整代码)

本文详细介绍了如何使用STM32 CubeMX和I2C驱动IST8310磁力计,从硬件连接到代码实现的完整流程。重点讲解了I2C通信异常处理、传感器初始化序列优化以及中断驱动数据采集方案,帮助开发者快速搭建可靠的地磁场数据采集系统。

weixin_42531163的博客 189

Device Mapper 代码分析

Device Mapper(DM)是Linux 2.6全面引入的块设备新构架,通过DM可以灵活地管理系统中所有的真实或虚拟的块设备。DM以块设备的形式注册到Linux内核中,凡是挂载(或者说“映射”)于DM结构下的块设备,不管他们是如何组织,如何通讯,在Linux看来都是一个完整的DM块设备。因此DM让不同组织形式的块设备或者块设备集群在Linux内核面前有一个完整统一的DM表示。一、DM

SonicLing的专栏 1万+

HDU 2601.An easy problem

题目:http://acm.hdu.edu.cn/showproblem.php?pid=2601 AC代码(C++): #include #include #include #include #include #define INF 0x3f3f3f3f #define eps 1e-8 using namespace std; long long A; int

njyexiong的博客 238

【ANSYS Workbench仿真】命令流:压力渗透pressure penetration

对与流体接触的part添加边界压力,使流体压力渗透点的接触应力与流体压力相等,以便得到真实的变形结果,就需要用到“pressure penetration”。 但是在ansys中,只能通过ADPL的形式添加,即在workbench中添加命令流的形式。此文主要介绍了**压力渗透的添加要点**和**命令流使用说明**。

路边小M's Blog 1万+

hdu2601 An easy problem

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2601 //n+1=(i+1)(j+1)=i*j+i+j #include #include int main() { int test,ans; _int64 n,i,temp; scanf("%d",&test); while(test--) { ans=0; s

不可不戒 745

踩遍Windows所有坑:Codex CLI桌面端+命令行双环境安装避坑实战

Windows下装Codex CLI的坑,本质上都是Windows本身的路径、环境变量、权限、编码这些历史遗留问题,和工具本身关系不大。只要避开中文路径、正确配置PATH、注意终端环境差异,其实安装非常简单。这套双环境方案配好之后,桌面端适合可视化调试、多会话管理,终端适合嵌入编辑器、脚本调用,一套配置两边通用,体验还是很流畅的。按照上面的流程走,基本不会出大问题,就算出问题也能在排查表里找到对应解法。

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 297

C#联合Halcon机器视觉框架源码

本软件参考EV开发,共用模块,基于WPF+Halcon,是非常不错的学习框架,需要什么功能可以自己添加,插件式开发非常方便。

Z's Palace 4825

HDU 2601An easy problem-素数的运用,暴力求解

An easy problem Time Limit: 3000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & %I64u Submit Status Description When Teddy was a child , he was always thinking abou

qq_18661257的专栏 1422

KEPServerEX 6 之 EX 6.11.718.0 发布说明

KEPServerEX 6.11.718.0 发布说明

-雲飛兄-博客 2881

HDU 2601 An easy problem(数学转换)

An easy problem Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9162    Accepted Submission(s): 2254 Problem Description When Teddy

超越自我就是成功 538

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

hdoj 2601 An easy problem 【技巧(转换思维)】

An easy problem Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8106    Accepted Submission(s): 1973 Problem Description When Teddy w

dxx_111的博客 669

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

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

hdu 2601 An easy problem(中)

http://acm.hdu.edu.cn/showproblem.php?pid=2601 n=i*j+i+j==>n+1=(i+1)*(j+1)==>2 /* 2011-9-22 author:BearFly1990 */ package acm.hdu.tests;

588

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

HDU 2601 An easy problem(数学)

An easy problem Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10301 Accepted Submission(s): 2604 Problem Description When Teddy was a ...

南风古 212

暴力 hdu2601 An easy problem

An easy problem Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7448    Accepted Submission(s): 1768 Problem Description When Teddy

chaoyueziji123的专栏 600

hdu 2601 An easy problem

题目:http://acm.hdu.edu.cn/showproblem.php?pid=2601 //本题考察的是整数的因子的个数, i * j + i + j =n,即为(i+1)*(j+1)=n+1,转化为了求解n+1的因子的个数 //int temp=sqrt(n);这一句放在for循环里面就会超时,真郁闷。   #include #include using namespace

836

HDU 2601 An easy problem

An easy problem Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9275    Accepted Submission(s): 2282 Problem Description When Teddy

Calm微笑 267

HDU 2601 An easy problem

Problem Description When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan buy 100 pig” .etc.. On

老鼠 684

hdu2601 An easy problem(数学)

题目意思: http://acm.hdu.edu.cn/showproblem.php?pid=2601 给出一个数N,求N=i*j+i+j一共有多少种方案。 题目分析: 此题直接暴力模拟即可,只是需要将上式转化为n+1=(i+1)*(j+1)进行计算即可。 AC代码: /** *hdu2601 An easy problem *意思:求n=i*j+i+j的种类

机器笨猫 912

HDU 2601:An easy problem【数学】

An easy problem Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 9414    Accepted Submission(s): 2326 Problem Description When Teddy

qq_35634181的博客 228

HDU-2601-An easy problem

题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2601 这题如果直接暴力的话,就会超时,我们需要变化n=i*j + i + j ;n=i*(j+1) + j; n+1=(i+1)*(j+1);就取余,就只要 一层循环了 我的代码 #include<stdio.h>#include<math.h>#include&lt...

weixin_30877227的博客 58

数学--数论-- HDU 2601 An easy problem(约束和)

Problem Description When Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan buy 100 pig” .etc.. One day ...

日拱一卒,功不唐捐 2850

HDU 2601 An easy problem I(基础数论)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2601 #include&lt;bits/stdc++.h&gt; using namespace std; #define debug puts("YES"); #define rep(x,y,z) for(int (x)=(y);(x)&lt;(z);(x)++) #define ll lon...

满月照亮的路 214
上一篇: HDU 3127 WHUgirls(完全背包)
下一篇: HDU 1080 Human Gene Functions(LCS变形)
Mr_Treeeee
博客等级 码龄10年 38粉丝 551原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值