HDU 5461 Largest Point (水)

DAIC-WOZ抑郁数据集实战:从申请到特征提取的全流程避坑指南 本文详细解析了DAIC-WOZ抑郁数据集从申请到特征提取的全流程,提供了实用的避坑指南和代码模板。涵盖数据获取技巧、多模态特征工程(面部动作单元、音频特征、文本处理)以及样本不平衡解决方案,帮助研究者高效处理这一经典抑郁分析数据集。 阅读详情

网络赛水题,主要是对t[i]平方,和t[i]分别排序,,然后先根据b的正负判断b该与哪个数相乘,然后在给a找数乘。

#pragma warning(disable:4996)
#include <cmath>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int N = 6000005;
typedef long long LL;
LL t[N];
int n;
LL a, b;
vector<LL>vec;

int main(){
    int T; scanf("%d", &T);
    int kase = 1;
    while (T--){
        scanf("%d %lld %lld", &n, &a, &b);
        vec.clear();
        for (int i = 1; i <= n; i++){
            int x;
            scanf("%d", &x);
            t[i] = (LL)x;
            vec.push_back(t[i] * t[i]);
        }
        sort(t + 1, t + 1 + n);
        sort(vec.begin(), vec.end());
        LL ans = 0;

        if (a > 0 && b > 0){
            if (vec[vec.size() - 1] == t[n] * t[n]) {
                ans = vec[vec.size() - 2] * a + b*t[n];
            }
            else{
                ans = vec[vec.size() - 1] * a + b*t[n];
            }
            ans = max(ans, a*t[n] * t[n] + b*t[n - 1]);
        }
        else if (a > 0 && b < 0) {
            if (vec[vec.size() - 1] == t[1] * t[1]) {
                ans = vec[vec.size() - 2] * a + b*t[1];
            }
            else{
                ans = vec[vec.size() - 1] * a + b*t[1];
            }
            ans = max(ans, a*t[1] * t[1] + b*t[2]);
        }
        else if (a<0 && b>0) {
            if (vec[0] == t[n] * t[n]){
                ans = vec[1] * a + b*t[n];
            }
            else{
                ans = vec[0] * a + b*t[n];
            }
            ans = max(ans, a*t[n] * t[n] + b*t[n - 1]);
        }
        else if (a < 0 && b < 0){
            if (vec[0] == t[1] * t[1]){
                ans = vec[1] * a + b*t[1];
            }
            else{
                ans = vec[0] * a + b*t[1];
            }
            ans = max(ans, a*t[1] * t[1] + b*t[2]);
        }
        else if (a == 0) {
            if (b >= 0)ans = b*t[n];
            else ans = b*t[1];
        }
        else{
            if (a > 0)ans = vec[vec.size() - 1] * a;
            else ans = vec[0] * a;
        }
        printf("Case #%d: %lld\n", kase++, ans);
    }
    return 0;
}


基于ROS的室内移动机器人自主导航技术 随着机器人技术的发展,近些年来室内移动机器人的研究热度越来越高。本文主要利用ROS操作系统对室内移动机器人的建图定位与自主导航关键技术进行研究。 ROS是目前开发较为完整具有广阔应用前景的开源机器人操作系统,具有分布式、模块化、代码复用等优良特点。同时ROS还提供了许多开源库,在这些库的基础之上研究同时定位与地图构建和机器人自主导航技术可以节省大量时间。 ORB-SLAM2是比较优秀的视觉SLAM算法之一,它具有计算量比较小、能够实时运行等优点。在介绍ORB-SLAM2的框架之前,首先会介绍视觉SLAM的一 阅读详情

相关推荐

人工智能顶会投稿指南:CCF-A类会议ACL、ICML、NeurIPS、ICLR的投稿周期与影响力解析

本文详细解析了CCF-A类会议ACL、ICML、NeurIPS、ICLR的投稿周期与影响力,涵盖各会议的投稿时间线、评审特点及录用率。ACL注重自然语言处理,ICML强调机器学习理论,NeurIPS覆盖神经信息处理,ICLR聚焦表征学习。文章还提供了实战投稿策略,帮助研究者提升投稿成功率。

weixin_29211309的博客 3395

Largest Point

Largest Point Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u SubmitStatus Description Given the sequence AA with nn integers t1,t2,⋯,tnt_1,t_2,\cdots,t_n. Given the in

STILLxjy 640

linux虚拟机和电脑ping通(可上网)

linux虚拟机(Ubuntu)和电脑ping通。

观则明的博客 4125

杭电5461———Largest Point

Given the sequence A with nn integers t1,t2,⋯,tn. Given the integral coefficients a and b. The fact that select two elements ti and tj of A and i≠j to maximize the value of ati+btj, becomes the larges

lxc2078420274的博客 273

深度强化学习 | 详解基于价值的强化学习DQN算法(附Pytorch实现)

深度Q网络DQN的核心原理是通过经验回放池和目标网络技术拟合高维状态空间,是Q-Learning算法的深度学习版本,本文分析DQN的基本算法,并给出训练实例和实际案例

FRIGIDWINTER的博客 4993

基于单光子探测的高重频多通道符合测距

TDC专栏之基于单光子探测的高重频多通道符合测距

sdau2005的博客 1208

杭电acm 5461 Largest Point

Problem Description Given the sequence A with n integers t1,t2,⋯,tn. Given the integral coefficients a and b. The fact that select two elements ti and tj of A and i≠j to maximize the value of at2i+bt

yeweiyang的博客 422

第67步 时间序列建模实战:ARIMA建模(Stata)

第67步 时间序列建模实战:ARIMA建模(Stata)

Jet4505的博客 6830

LARGEST POINT

Given the sequence A with n integers t1 , t2 , …… , tn . Given the integral coefficients a and b. The fact that select two elements ti and tj of A and i ≠ j to maximize the value of becomes the large...

to的博客 296

姿态传感器/陀螺仪之BMI270应用原理图设计

BMI270是一款由博世(Bosch)推出的高性能、超低功耗惯性测量单元(IMU),专为可穿戴设备、智能设备及物联网应用设计。

corlin6688的博客 2879

Linux 完全卸载 Neovim 的方法:解决权限问题和清除残留文件

Neovim 没有被完全卸载的原因,可能是因为它是通过非官方方式(如手动编译或二进制包)安装的。对于这种情况,使用apt卸载命令无法删除这些文件。因此,需要手动删除和中的相关文件。建议在安装软件时,尽量使用包管理器(如apt)进行安装,以便以后能够方便地卸载。如果你不太熟悉 Linux 系统,避免手动操作系统目录,除非你非常清楚自己的操作。通过上述方法,你应该能够彻底卸载 Neovim 并重新安装。

代码简单说 Vue、JAVA、PHP、Node.js 熟练运用,接口、架构、性能全搞定。 4951

HDU 5461 Largest Point (水题)

Problem Description Given the sequence A with n integers t1,t2,⋯,tn. Given the integral coefficients a and b. The fact that select two elements ti and tj of A and i≠j to maximize the value of

AK_HuangYC的博客 627

恒玄BES调试笔记-BES2500如何Dump Anc Audio数据

从YP的4M flash改HP3的2M flash只需要改: 原工程:target.mk的export FLASH_SIZE ?= 0x200000和common.mk里的KBUILD_CPPFLAGS += -DNEW_IMAGE_FLASH_OFFSET=0x100000 OTA工程:target.mk的NEW_IMAGE_FLASH_OFFSET ?= 0x100000和FLASH_SIZE ?= 0x200000 ...

leezs的博客 1674

HDU 5461 Largest Point 水题

先给n,a,b。然后有n个数,t1,t2,t3,,,,tn,然后找到合适的ti和tj(i!=j),使得a*ti^2+b*tj最大。 a,b,和ti都属于[-10^6,10^6]。 不妨设c=a*ti^2+b*tj。a>0时,ti的绝对值越大,c越大,a0时,tj的值越大,c越大,b 有了这个之后,我们根据a的正负,ti取绝对值最大或最小的那个数,根据b的正负,tj取最大或最小的那个数。 当

一蓑烟雨任平生 383

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

efm32 入门.pdf

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

hdu 5461 Largest Point(水)

题目链接:hdu 5461 Largest Point解题思路暴力维护at2at^2和btbt的最大值和次大值。代码#include <cstdio> #include <cstring> #include <vector> #include <algorithm>using namespace std; typedef long long ll; const ll inf = 0x3f3f3f3f

不慌不忙、不急不躁 707

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

HDU 5461 Largest Point(水)

思路:直接分成两部分考虑,排个序就可以了 #include using namespace std; #define LL long long const int maxn = 5*1e6+7; LL a[maxn]; struct Node { LL w; int id; }a1[maxn],b1[maxn]; bool cmp(Node a,Node b){return a.w>

围巾的ACM博客 421

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

HDU 5461 Largest Point(2015沈阳赛区网络赛+技巧水题)

Largest Point Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 637 Accepted Submission(s): 266 Problem Description Given the sequence A w

Sterben_Da的博客 751

HDU 5461Largest Point

Largest Point Time Limit: 1500/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 527    Accepted Submission(s): 228 Problem Description Given the sequ

Dream_M 1298

hdu 5461 Largest Point 2015 ACM/ICPC Asia Regional Shenyang Online

这道题因为多写了几行memset就MLE了==。贪心分别保证at^2最大,b^t次大,at^2次大,b^t最大,最后选择max即可。 #include #include #include #include #include #include #include #include #include #include #include #include #include #include //hdu

TimeForMiracles 498

Largest Point HDU - 5461

2018TYUT暑期ACM模拟赛(10) Largest Point HDU - 5461 思路:一个结构体直接保存t*t*a和t*b,利用两个比较函数将两个值分别进行从小到大排序,保留最大的两位,如果id相同就找交叉相选最大的,id不同直接输出最大的两个值相加。 #include&lt;iostream&gt; #include&lt;cstdio&gt; #include&lt;al...

DeathYmz的博客 650

HDU 5461 Largest Point

。

大咸鱼。。。 572

HDU5461 Largest Point 贪心

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5461 题目大意:给出一个数组t0,t1,...,tn-1,和整数a,b,找出a*ti^2+b*tj(i!=j)的最大值。 分析:对于数组中的每一个t,我们用两个数组A和B分别纪录a*ti^2和b*ti,然后对这两个数组排序,如果两个数组最大值的下标不同,那么相加就是最大值了,如果相

AC_Gibson的专栏 892

hdu 5461 Largest Point

原题链接: http://acm.hdu.edu.cn/showproblem.php?pid=5461 小技巧: 把ti计算成ti*ti的形式。 代码如下: #include #include #include #include using namespace std; typedef long long LL; typedef pair PLL;//fi

sunshine_YG的专栏 885

Largest Point hdu 5461

http://acm.hdu.edu.cn/showproblem.php?pid=5461 分析:一开始很撒很撒的分了很多种情况去写了,后来发现可以先储存a*num*num和b*num的值,然后再判断最大值。。 #include <iostream> #include <stdio.h> #include <string.h&...

weixin_30408675的博客 91

HDU - 5461 Largest Point

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5461 题意:求a*c[i]*c[i]+b*c[j]的最大值; Sample Input 2 3 2 1 1 2 3 5 -1 0 -3 -3 0 3 3 Sample Output Case #1: 20 Case #2: 0 先贴一个还不明白该...

weixin_30882895的博客 111

hdu 5461 Largest Point 暴力

Largest Point Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5461 Description Given the sequence A with n integers t1,t2,⋯,tn. Given ...

weixin_30549175的博客 76
上一篇: HDU 5459 Jesus Is Here(DP)
下一篇: HDU 1541 Stars (树状数组)
acraz
博客等级 码龄12年 3粉丝 104原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值