POJ 2785 4 Values whose Sum is 0

遥感影像分割实战:LoveDA数据集从下载到训练全流程指南(附避坑技巧) 本文以LoveDA数据集为例,提供了一份详尽的遥感影像语义分割实战指南。内容涵盖从数据下载、理解与预处理,到环境配置、模型选择与训练,再到性能调优与部署的全流程,并重点分享了多个关键环节的避坑技巧,旨在帮助开发者和研究者高效上手并解决实际问题。 阅读详情

题目传送门

【题意】题意很简单,给了n*4的矩阵,问有多少种情况满足每一列取一个某个数字,加起来为0.

【解题思路】 Hash.

【AC代码】

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
using namespace std;
#define CLE(a,b) memset(a,b,sizeof(a))
#define MEC(a,b) memcpy(a,b,sizeof(a))
const int mod = 16000000;//6-8 digit prime.
int has[16000010];
int cnt[16000010];
int n,a[4010][4];
void make_hash(int num)
{
    int key = (num%mod+mod)%mod;//divisible hash.
    while((has[key]!=num)&&cnt[key]!=0) key = (key+1)%mod;//liner detect.
    has[key] = num;
    cnt[key] ++;
}
int get_num(int num)
{
    int key = (num%mod+mod)%mod;
    while((has[key]!=num)&&cnt[key]!=0) key = (key+1)%mod;
    return cnt[key];
}

int main()
{
    while(~scanf("%d",&n))
    {
        for(int i=1; i<=n; i++)
        {
            for(int j=0; j<4; j++)
            {
                scanf("%d",&a[i][j]);
            }
        }
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=n; j++)
            {
                make_hash(a[i][0]+a[j][1]);
            }
        }
        int ans = 0;
        for(int i=1; i<=n; i++)
        {
            for(int j=1; j<=n; j++)
            {
                ans += get_num(-(a[i][2]+a[j][3]));
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

海康威视iVMS-8700综合安防管理平台 文件读取漏洞复现 HIKVISION iVMS 综合安防管理平台download接口处存在任意文件读取漏洞,攻击者通过构造token绕过身份认证,读取服务器中的目录信息与敏感文件。使系统处于极不安全的状态。 阅读详情

相关推荐

AI自主网络攻击技术深度解析:从LLM驱动到防御体系升级

网络安全领域正经历从自动化脚本到智能自主攻击的范式转变。其核心原理在于将大型语言模型(LLM)与自动化渗透测试框架深度融合,构建具备环境感知、决策规划和自适应能力的攻击系统。这种技术的核心价值在于实现了从预设步骤到目标驱动的质变,能自主完成信息收集、漏洞利用、横向移动等复杂攻击链。在应用场景上,它不仅能极大提升高级持续性威胁(APT)的攻击效率,也对渗透测试和红队演练技术提出了新的要求。面对此类由AI驱动的自主攻击,传统的基于签名的防御体系已显不足,必须转向以行为分析和零信任为核心的整体纵深防御。本次曝光的

weixin_34254464的博客 605

POJ-2785 4 Values whose Sum is 0

二分查找POJ-2785 4 Values whose Sum is 0 POJ-2785 题目大意:输入四列数 代表集合a,b,c,d 问ai+bi+ci+di相加等于0的组合有多少种 解题思路:将ab集合每种组合对应的和储存 cd也是一样 然后查找cd集合中是否有ab集合元素的复数 ab集合和cd集合的大小最大可达4000*4000 直接遍历查找会超时 所以用二分查找法(注意在二分查找的时候 ...

鱼头的水题之路 571

LayaNative源码编译

修改好后的LayaNative2.0需要重新编译生成Android和iOS所需要的动态库文件。

末之 1359

POJ2785:4 Values whose Sum is 0(二分)

Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0 .

ACM!荣耀之路! 5093

基于C#的ASP.NET开发的党史学习网站课设

开展党史学习教育,就是要以史为镜、以史明志,把苦难辉煌的过去、日新月异的现在、光明宏大的未来贯通起来,在鉴往知来中砥砺前行,在乱云飞渡中把准航向,在凝心聚力中团结奋斗,共同创造新的历史伟业。登陆按钮与数据库进行连接,逻辑实现是如图3.1.3所示,自己定义一个SQL查询语句,将账号、密码放入SQL查询语句中,用sqlDataReader.HasRows语句进行逐一比较,找出结果,将用户名存入session并调用cookies,如果结果存在就关闭数据库,进行数据跳转,并弹出登陆成功的提示框,并关闭数据库。

m0_62408555的博客 974

【半导体工业实战】C#.NET开发SECS/GEM协议上位机(完整可运行源码+全进制转换工具类+工业级通信封装)

在半导体这个高精尖的工业领域,SECS/GEM协议是设备通信的基石,而C#.NET凭借其稳定性、高效的字节处理能力、Windows工控机的深度适配,成为SECS上位机开发的最优选择。本文从半导体行业的专属认知出发,提供了完整的进制转换工具类、工业级的SECS通信封装、实战的报文解析与业务调用示例、半导体专属的避坑指南,所有内容均为真实项目经验的沉淀,无空洞理论、无AI冗余文字,所有源码均可直接编译运行、无缝移植到半导体项目中。半导体工控开发的核心,从来不是炫技,而是。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 897

poj 2785 4 Values whose Sum is 0 (二分+枚举)

题目链接:http://poj.org/problem?id=2785 题目大意:  给出四个长度为n的列表(从上到下)                     从每个列表分别取出一个数据,使得相加的结果为0                     问最多存在多少种情况? 解题思路:  n的范围(1                     可以转化为O(2*n^2):

ンZee的解题报告 1156

[Python + UG NX 二次开发新手教程] 第五课 采用Python / UF 开发模式

在 NX 二次开发里看到的“UF”是的缩写,它是 Siemens 提供的集合,也是整个 NX Open 体系里最贴近内核、历史最悠久的一套接口。相当于 NX 的“系统调用”——只要 NX 能做的事,UF 几乎都能调得动。Siemens 从 NX 12 开始把原来的 C 接口(UF)全部打包进了官方 Python 模块,命名空间为 NXOpen.UF.*,所以只要 NX 安装目录里带了 NXOpen\UF 子模块,就能在 Python 里直接调用 UF 函数。

温良 1004

POJ 2785:4 Values whose Sum is 0

http://poj.org/problem?id=2785 这道题目意思很简单,但是数据量很庞大,就需要设计比较好的算法。 方法一:利用二分搜索算法。根据题意,我们将数据分为左右两个部分,然后将左侧的两列之和加起来,然后排序,在对右侧的两列加起来,二分搜索相应的解的上下限。这里需要注意对一个数出现的上下界的寻找办法,代码要注意,也可以通过STL中的lower_bound与upperbound

BootStar 699

基于深度学习YOLOv10的人脸表情识别系统(附完整资源+PySide6界面+训练代码)

本文介绍了如何基于YOLOv10实现一个人脸表情识别系统。我们从数据集准备、模型训练到PySide6界面实现进行了详细的讲解。通过该系统,用户可以实时检测和分类人脸表情,为情感分析、智能交互等应用场景提供支持。

YOLO 1053

在 ABAP SEGW OData 服务里,把 Function Import 参数长度校验真正跑起来

SAP Gateway服务中Function Import参数长度校验的实现机制解析:在SEGW中定义Max Length参数后,需通过模型特性USE_STRICT_FUNCTION_PARAM_CHK(7.52+版本支持)启用严格检查。该特性需在MPC_EXT的DEFINE方法中设置,框架会在URI解析阶段拦截超长参数,避免错误进入业务逻辑。对于低版本系统,建议在应用层手动添加校验。这种模型驱动的方式符合Clean Core原则,能有效提升接口健壮性。

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

POJ2785 4 Values whose Sum is 0 【枚举】

4 Values whose Sum is 0 Time Limit: 15000MS   Memory Limit: 228000K Total Submissions: 16000   Accepted: 4625 Case Time Limit: 5000MS Description The SUM problem can

长风的专栏 977

《用 R 探索医药数据科学》目录(持续更新,已超 250 万字)|订阅前说明

我们重磅推出《用 R 探索医药数据科学》专栏!本文作为专栏【订阅后首读】的核心内容,堪称开启学习之旅的 “入门钥匙”,也是整个专栏最关键的一篇指引文。文中不仅完整呈现了专栏 9 大核心篇章 + 问答板块的详细目录,更囊括了订阅后必知的核心要点 —— 从阅读设备、实操工具的使用建议,到学习路径、更新规则的清晰说明,再到问题反馈、感悟记录的实用方法,一站式帮你摸清专栏框架、找准学习方向。建议各位订阅者务必认真阅读、吃透内容,这能让你后续的学习更高效、少走弯!

MD Code 1万+

poj 2785 4 Values whose Sum is 0

4 Values whose Sum is 0 Time Limit: 15000MS   Memory Limit: 228000K Total Submissions: 14474   Accepted: 4137 Case Time Limit: 5000MS Description The SUM problem can

liu_fanyi3的专栏 637

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

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

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

POJ - 2785 4 Values whose Sum is 0

Time Limit: 15000MS   Memory Limit: 228000K Total Submissions: 28911   Accepted: 8744 Case Time Limit: 5000MS Description The SUM problem can be formulated as follows: given four li...

LOVE&AI的博客 284

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

【POJ 2785 --- 4 Values whose Sum is 0 】二分枚举

【POJ 2785 --- 4 Values whose Sum is 0 】二分枚举 Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x...

来日浅谈的博客 571

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

4 Values whose Sum is 0(POJ-2785)

Problem Description The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d...

Alex_McAvoy的博客 2246

POJ 2785:4 Values whose Sum is 0

4 Values whose Sum is 0 Time Limit: 15000MS   Memory Limit: 228000K Total Submissions: 19331   Accepted: 5783 Case Time Limit: 5000MS Description The SUM problem c

枫闲言的博客 443

poj2785(4 Values whose Sum is 0)

Language: Default 4 Values whose Sum is 0 Time Limit: 15000MS   Memory Limit: 228000K Total Submissions: 19972   Accepted: 5953 Case Time Limit: 5000MS Description

相思作坊半世离殇的博客 495

POJ 2785 4 Values whose Sum is 0 hash

4 Values whose Sum is 0 Time Limit: 15000MS   Memory Limit: 228000K Total Submissions: 14198   Accepted: 4027 Case Time Limit: 5000MS Description The SUM problem can

kdwycz的刷题空间 781

POJ 2785 4 Values whose sum is 0

4 Values whose Sum is 0Time Limit: 15000MS Memory Limit: 228000K Total Submissions: 24017 Accepted: 7283 Case Time Limit: 5000MSDescriptionThe SUM problem can be formulated as follows: giv

broken_promise的博客 325

4 Values whose Sum is 0 POJ 2785

很有意思的一道题,四个数组可以先加两个,另外两个再来找相加等于前面相加的,把n4方的复杂度降到了n2方logn #include<iostream> #include<algorithm> using namespace std; const int MAXN=4050; int a[MAXN],b[MAXN],c[MAXN],d[MAXN]; int ab[MA...

KEIke0的博客 462
上一篇: POJ 1200 Crazy Search
下一篇: Educational Codeforences Round 9 B
just_sort
博客等级 码龄11年 2357粉丝 1667原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值