hdu 4282 A very hard mathematic problem(二分+枚举)

逆向工程师视角:拆解DataDome滑块验证码的3层防护机制与绕过思路 本文从逆向工程师视角,深入剖析DataDome滑块验证码的三层核心防护机制。第一层通过动态加密参数实现会话绑定与抗重放;第二层采集TLS指纹、鼠标轨迹动力学等多维行为数据进行一致性验证;第三层则是基于机器学习的后端异步风险决策引擎。文章不仅拆解了其技术原理,更分享了模拟、钩取等超越单纯工具调用的底层分析与绕过思路。 阅读详情

A very hard mathematic problem

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2581    Accepted Submission(s): 747


Problem Description
  Haoren is very good at solving mathematic problems. Today he is working a problem like this: 
  Find three positive integers X, Y and Z (X < Y, Z > 1) that holds
   X^Z + Y^Z + XYZ = K
  where K is another given integer.
  Here the operator “^” means power, e.g., 2^3 = 2 * 2 * 2.
  Finding a solution is quite easy to Haoren. Now he wants to challenge more: What’s the total number of different solutions?
  Surprisingly, he is unable to solve this one. It seems that it’s really a very hard mathematic problem.
  Now, it’s your turn.
 

Input
  There are multiple test cases. 
  For each case, there is only one integer K (0 < K < 2^31) in a line.
  K = 0 implies the end of input.
  
 

Output
  Output the total number of solutions in a line for each test case.
 

Sample Input
  
9 53 6 0
 

Sample Output
  
1 1 0   
Hint
9 = 1^2 + 2^2 + 1 * 2 * 2 53 = 2^3 + 3^3 + 2 * 3 * 3
 

Source
 

Recommend
liuyiding

思路:枚举y和次数z然后二分查找是否有符合条件的x出现y*y<2^31 z增加值将是指数上涨所以时间复杂度为,log(k)*log(k)*sqrt(k)


#include<iostream>
#include<cstring>
using namespace std;
const int mm=1000;
long long yz;
bool ok(long long z,long long y,long long k)
{
  long long l=1,r=y-1,mid,xx,sum;
  while(l<=r)
  {
    mid=(l+r)/2;
    xx=1;
    for(int i=0;i<z;i++)
      xx*=mid;
    sum=xx+mid*yz;
    if(sum==k)return 1;
    else if(sum<k)l=mid+1;
    else r=mid-1;
  }
  return 0;
}
int main()
{ long long k,x,y,z,ans;
  while(cin>>k&&k)
  {
    ans=0;x=1;y=2;z=2;
    ///枚举y和次数z
    for(y=2;y*y<=k;y++)
      for(z=2;;z++)
    { 
      long long yy=1;
      for(int i=0;i<z;i++)
        yy*=y;
      if(yy>k)
        break;
      yz=y*z;
      ///y,z确定,二分查找是否有符合条件的x出现
      if(ok(z,y,k-yy))ans++;
    }
    cout<<ans<<"\n";
  }
}





R 语言 ggplot2 绘制精美高级全球地图 在本教程中,我们将学习如何使用R语言和ggplot2包绘制精美高级地图。ggplot2是一个功能强大的数据可视化包,它可以让我们创建漂亮、交互式的地图。我们将使用R中的一些其他包来处理地理空间数据,以便与ggplot2无缝协作。 阅读详情

相关推荐

IoT 平台架构全景图:从设备到 AI 的完整技术体系深度解析

随着物联网设备规模进入百万级时代,IoT 平台架构已经从简单的设备接入系统演变为完整的数据平台。本文从系统架构师视角,深度解析 IoT 平台的完整技术体系,包括设备接入、MQTT 通信、消息流平台、数据平台与 AI 决策系统,并结合主流云平台实践,构建从设备到 AI 的完整 AIoT 架构认知。

moton2017的博客 856

HDU 4282 A very hard mathematic problem 第37届ACM/ICPC长春赛区网络赛1005题 (暴力)

A very hard mathematic problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 964    Accepted Submission(s): 279 Problem Description   Haore...

weixin_33762321的博客 191

GEO优化实战:用AnswerBit量化AI搜索可见度与品牌监控体系

生成式引擎优化(GEO)正取代传统SEO,成为品牌在AI搜索生态中获取可见度的关键。当用户习惯从“翻列表”转向“直接问AI”,品牌能否被生成式引擎识别、引用并正向推荐,直接决定了其在用户决策链条中的存在感。AI搜索可见度因此从模糊概念演变为可度量的运营指标,涵盖提及率、引文率、情感分与回源质量等维度。腾讯AnswerBit作为答案侧分析工具,帮助运营者拆解AI回复中的品牌语境与引用来源,让优化动作有据可循。从内容结构化改造、品牌实体建设到第三方权威背书,GEO要求团队建立“度量-优化-再度量”的闭环。文章结

weixin_31100517的博客 150

A very hard mathematic problem

E - A very hard mathematic problem Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4282 Description   Haoren is very good at s

梧桐下的四叶草 1042

【课程设计】TCP/IP 应用环境中服务器的部署与实现

本项目旨在通过搭建一个虚拟网络环境,实现软路由系统的配置和服务器的搭建与测试。具体包括安装虚拟机 VMWare Workstation,安装 Windows Server 2003 操作系统,配置软路由系统(包括双网卡安装、协议配置和测试),以及搭建并测试 DHCP 服务、DNS 服务、WWW 服务、FTP 服务和 SMTP/POP3 服务。

weixin_74907236的博客 1524

HDU 4282 A very hard mathematic problem 二分题目

http://acm.hdu.edu.cn/showproblem.php?pid=4282 题解:http://www.cnblogs.com/E-star/archive/2012/09/11/2680992.html View Code #include <iostream> #include <cstdio> #include <cstring...

weixin_30415113的博客 133

计算机视觉与深度学习 | 基于Matlab的多特征融合可视化指纹识别系统(附完整代码)

此系统展示了一个完整的指纹识别流程,实际应用中可以根据需求进一步优化算法,如改进方向场计算、增加脊线频率特征、使用更精确的匹配算法等。

尘世冰封的专栏 360

HDUOJ 4282 A very hard mathematic problem

#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define CLOSE() ios::sync_with_stdio(fal

%%% 409

基于STM32设计的老人摔倒检测报警系统(OneNet+MQTT)(235)

基于STM32设计的老人摔倒检测报警系统,不仅能够实时监测老人的位置信息,方便在紧急情况下快速定位,还能通过陀螺仪模块精确检测老人的身体姿态,一旦判断为摔倒状态,系统将立即触发蜂鸣器报警,并通过4G网络向指定联系人发送短信警示,确保老人能够迅速得到援助。此外,系统还支持老人主动按下设备上的按键发送求助短信,增强了系统的灵活性和实用性。

4690

利用baostock获取上市公司财务指标

利用baostock获取上市公司的财务指标 1、导入模块,登录baostock import baostock as bs import pandas as pd import time # 登陆系统 lg = bs.login() # 显示登陆返回信息 print('login respond error_code:'+lg.error_code) print('login respond error_msg:'+lg.error_msg) 2、查询股票代码、行业板块 # 查询股票代码 rs=.

firefox_yau的博客 2098

HDU 4282 A very hard mathematic problem (暴力枚举+二分+各种剪枝)

A very hard mathematic problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8579    Accepted Submission(s): 2624   Problem Description   ...

LSD20164388的博客 593

ATS Request中的PASID的作用是什么

摘要: PASID(进程地址空间标识符)是PCIe ATS(地址转换服务)中的关键组件,用于标识不同进程或虚拟机的地址空间。其主要作用包括:1)支持多进程共享设备时隔离地址空间;2)实现共享虚拟地址(SVA),允许用户态程序直接访问设备;3)提升虚拟化性能(如SIOV),通过PASID区分虚拟机请求;4)增强安全性,基于PASID限制设备内存访问权限。PASID通过20位标识符在TLP前缀中传递,与IOMMU协作完成地址转换与缓存,适用于高性能计算、AI及虚拟化场景,但依赖硬件支持和软件适配。

元直的博客 1561

HDU4282 A very hard mathematic problem(枚举+二分)

HDU4282 A very hard mathematic problem(枚举+二分)

追梦赤子心 1048

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

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

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

HDU 4282 A very hard mathematic problem (涉及3个数字 用 枚举+二分)

Problem Description   Haoren is very good at solving mathematic problems. Today he is working a problem like this:    Find three positive integers X, Y and Z (X 1) that holds    X^Z + Y^Z +

深海沧澜的博客 543

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

hdu 4282A very hard mathematic problem(枚举+二分)

A very hard mathematic problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3578    Accepted Submission(s): 1052 Problem Descriptio

布生气 1621

深度学习工具包 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 4282 A very hard mathematic problem-卡时间-(二分枚举)

题意:x^z+y^z+xyz=k,给定k求出满足该式子的x,y有多少种。(x1,k 分析: 一看就是卡时间的题,这种题一般方法是枚举,但是要先分析一下数据的关系,把枚举的变量的数据范围缩小到可接受的程度;另外二分在这种题里是常用的方法。 本题要复杂一点,有三个变量都要枚举。首先z作为幂,而k 然后是做法:因为有三个变量,如果用上面估算得到的范围来枚举,三重循环还是会超时,这就要求我们用效率

关于学习本身 1022

HDU-4282 A very hard mathematic problem 技巧枚举+二分

题意xz+yz+x∗y∗z=kx^z+y^z+x*y*z = k ( y>x&&z>1y>x&&z>1) 给我们这个等式让我们找出这里面有多少个不同的可行解分析表面上数据范围比较大 但由于k最大都在int范围内 由于后面还有一个x*y*z 于是这个式子的指数不会超过31 再来分析x和y 这里必定是一个y大x小 那么假如我们先枚举一个数 那么另一个数的范围必定就是 1~y-1 由于这个式子是

qq_33859479的博客 325

HDU 4282 A very hard mathematic problem --枚举+二分(或不加)

题意:问方程X^Z + Y^Z + XYZ = K (X<Y,Z>1)有多少个正整数解 (K<2^31) 解法:看K不大,而且不难看出 Z<=30, X<=sqrt(K), 可以枚举X和Z,然后二分找Y,这样的话不把pow函数用数组存起来的话好像会T,可以先预处理出1~47000的2~30次幂,这样就不会T了。 但是还可以简化,当Z=2时,X^2+Y^...

weixin_30672019的博客 146

【二分搜索】 hdu4282 A very hard mathematic problem

A very hard mathematic problem 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4282 题意: X^Z + Y^Z + XYZ = K, (X 1)。告诉你最后K(0 的值,问符合这个等式的X,Y,Z的组合有多少种 题解:因为幂次的增长速度比较快,我们可以枚举X和Z,然后二分搜索是否存在对应的Y。对于A的B次方我

Ted's 游乐园 3248

HDU 4282 A very hard mathematic problem 二分

来源:http://acm.hdu.edu.cn/showproblem.php?pid=4282 题意:给出一个数n,问x^z + y^z + x*y*z = n有多少这样的x y z,其中y > x,z > 1,x,y,z都是正数。 思路:注意到z最大为31,x最大为50000,因此可以枚举x,z,二分判断y即可。 代码: #include #include #include #

1066

hdu 4282 A very hard mathematic problem 二分法

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4282 题意:。告诉我们K的大小,问符合这个等式的X,Y,Z的组合有多少种。 因为幂次的增长速度比较快,我们可以枚举X和Z,这样我们可以把三重循环降低到二重循环,然后二分搜索每一对(X,Z)是否存在对应的Y。对于A的B次方我们可以先打表储存,使用的时候直接调用,这样也可以降低一定的时间复杂度

弱菜zc 827

A very hard mathematic problem HDU - 4282(二分)

Haoren is very good at solving mathematic problems. Today he is working a problem like this:   Find three positive integers X, Y and Z (X < Y, Z > 1) that holds    X^Z + Y^Z + XYZ = K   where K ...

tomjobs的博客 445

HDU 4282 A very hard mathematic problem

Problem Description Haoren is very good at solving mathematic problems. Today he is working a problem like this: Find three positive integers X, Y and Z (X < Y, Z > 1) that holds X^Z + Y^Z + XYZ...

qq_43482330的博客 293

hdu4282 A very hard mathematic problem

Haoren is very good at solving mathematic problems. Today he is working a problem like this:   Find three positive integers X, Y and Z (X 1) that holds    X^Z + Y^Z + XYZ = K   where K is anot

mwhybmj的博客 470

hdu 4282 A very hard mathematic problem(二分)

Haoren is very good at solving mathematic problems. Today he is working a problem like this:    Find three positive integers X, Y and Z (X 1) that holds    X^Z + Y^Z + XYZ = K   where K is another

芒果街上的小屋(此博客暂时停用) 467
上一篇: poj 1079 Cube Stacking(并查集)
下一篇: hdu 4430 Yukari's Birthday(二分+枚举)
剑不飞
博客等级 码龄15年 86粉丝 505原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值