QSC and Master

本文介绍了一个经典的算法问题,QSC需要解决一个涉及数字对(key,value)的谜题,通过寻找非互质的key来最大化value之和。文章详细解析了使用区间动态规划解决此问题的方法。

http://acm.hdu.edu.cn/showproblem.php?pid=5900

QSC and Master
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 488 Accepted Submission(s): 154

Problem Description

Every school has some legends, Northeastern University is the same.

Enter from the north gate of Northeastern University,You are facing the main building of Northeastern University.Ninety-nine percent of the students have not been there,It is said that there is a monster in it.

QSCI am a curious NEU_ACMer,This is the story he told us.

It’s a certain period,QSCI am in a dark night, secretly sneaked into the East Building,hope to see the master.After a serious search,He finally saw the little master in a dark corner. The master said:

“You and I, we’re interfacing.please solve my little puzzle!

There are N pairs of numbers,Each pair consists of a key and a value,Now you need to move out some of the pairs to get the score.You can move out two continuous pairs,if and only if their keys are non coprime(their gcd is not one).The final score you get is the sum of all pair’s value which be moved out. May I ask how many points you can get the most?

The answer you give is directly related to your final exam results~The young man~”

QSC is very sad when he told the story,He failed his linear algebra that year because he didn’t work out the puzzle.

Could you solve this puzzle?

(Data range:1<=N<=300
1<=Ai.key<=1,000,000,000
0

/*
题目:1009 QSC and Master
链接:http://acm.hdu.edu.cn/showproblem.php?pid=5900
题意:给n对数字(key,value),但且仅当相邻的两对数字的key不互质,
      那么就可以把他们拿掉并且获得这两对数字对应的value和,问最多可以得到
      的价值总和?
思路:用区间dp是显然的,dp[i][j]=max{dp[i][k]+dp[k+1][j]},但是根据题目的特殊性,
      还必须考虑先中间后两边的策略可能性,也就是dp[i][j]=max(dp[i][j],dp[i+1][j-1]+value[i]+value[j]),
      当然需要一些前提条件:1.gcd(key[i],key[j])!=1; 2.i->j之间的值要全部取出;
      于是有了以下转移方程:
      dp[i][j]=max(  max{dp[i][k]+dp[k+1][j]},  (vis[i+1][j-1]&&gcd(key[i],key[j])!=1)?
      (dp[i+1][j-1]+value[i]+value[j]):-1 );
      vis[i][j] |= (vis[i][k] && vis[k+1][j]) || (vis[i+1][j-1]&&gcd(key[i],key[j])!=1);
      vis[i][j]==1表明从i->j之间的数都可以拿掉,自然也是最优策略;
      递推方向是区间由小到大, 边界也能自然想到,详见代码:
*/

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>

using namespace std;
typedef long long LL;

LL dp[310][310];
int vis[310][310];
int n;
LL data[2][310];
LL gcd(LL a,LL b)
{
    return b==0?a:gcd(b,a%b);
}
void to_dp()
{
    memset(vis,0,sizeof vis);
    for (int i=0;i<n;i++){
        dp[i][i]=0;//边界
    }
    for (int i=0;i<n-1;i++){
        LL a=gcd(data[0][i],data[0][i+1]);
        dp[i][i+1]=(a==1?0:(data[1][i]+data[1][i+1]));//边界
        if (a!=1)  vis[i][i+1]=1;//边界
    }
    for (int l=2;l<n;l++){
        for (int i=0;i+l<n;i++){//区间长度由小到大
            int j=i+l;
            dp[i][j]=0;//初值
            for (int k=i;k<j;k++){//区间dp
                if (dp[i][k]+dp[k+1][j] > dp[i][j]){//更新更优策略
                    dp[i][j]=dp[i][k]+dp[k+1][j];
                    if (vis[i][k]&&vis[k+1][j]){//可以全取
                        vis[i][j]=1;
                    }
                }
            }
            if ( vis[i+1][j-1] && (gcd(data[0][i],data[0][j])!=1) ){//可以全取,肯定是最有策略,更新
                vis[i][j]=1;
                dp[i][j]=dp[i+1][j-1]+data[1][i]+data[1][j];
            }
        }
    }
}
int main()
{
    int t;
    scanf("%d",&t);
    while (t--)
    {
        scanf("%d",&n);
        for (int i=0;i<2;i++){
            for (int j=0;j<n;j++){
                scanf("%I64d",&data[i][j]);
            }
        }
        to_dp();
        printf("%I64d\n",dp[0][n-1]);
    }
    return 0;
}
<think>好的,我需要处理用户关于“QSC IT技术相关”的查询。首先,用户意图不太明确,但根据关键词QSC和IT技术,推测可能涉及QSC公司的技术产品、解决方案或相关IT应用。接下来,需要调用网络搜索工具查找QSC的技术相关内容。 首先,搜索QSC公司的背景,确认其主营业务。QSC可能指QSC AG,一家德国的专业音频和IT解决方案提供商。然后,查找他们最新的IT技术产品,比如Q-SYS平台,云服务,网络音频解决方案等。此外,可能涉及QSC在音视频集成、网络架构、企业通信方面的技术应用。 需要整合信息,分点说明QSC的IT技术相关产品和服务。确保每个方法或步骤清晰,避免使用第一人称和步骤词汇。同时,注意引用分散在回答中,不集中末尾。最后生成相关问题,需基于回答内容,至少三个,例如询问具体产品细节、技术架构或应用场景。 检查格式要求,数学公式和代码部分用户问题中可能不涉及,但需保持警惕。最后确保相关问题部分正确格式,使用指定标题,编号正确,无多余空格或换行。完成回答后,再次验证是否符合所有用户要求。</think>根据QSC公司的技术布局,其IT相关技术主要聚焦于音视频网络化解决方案与云服务架构。QSC(原QSC Audio Products)近年来已转型为以Q-SYS为核心的软件定义平台提供商,在IT领域的关键技术包括: **1. Q-SYS生态系统** 基于Linux的实时操作系统支持网络化音视频处理,具备SDK/API接口供第三方集成。典型应用包含动态设备发现($mDNS$协议)、基于WebSocket的控制协议,支持通过RESTful API实现跨平台管理: ```python # Q-SYS插件控制示例 import requests url = "http://qsys-core/control/device/volume" payload = {"level": -20} response = requests.post(url, json=payload) ``` **2. 网络音频传输技术** 采用自适应音频编解码算法(QSC专有Dante扩展),支持千兆以太网传输256通道无损音频流。网络架构要求遵循$PTPv2$时钟同步协议,时延控制在<2ms(依据IEEE 1588标准),交换机需满足AVB/TSN标准。 **3. 云管理平台** Q-SYS Reflect企业版提供基于AWS的云管理服务,采用$OAuth 2.0$认证流程。通过MQTT协议实现设备状态监控,支持批量固件更新与配置模板部署,满足ISO 27001安全标准的数据加密传输。 **4. 边缘计算应用** Q-SYS NV系列处理器集成Intel Core i7处理器,支持在边缘节点运行Docker容器。典型用例包括通过OpenCV实现人脸识别的自动会议系统,音频流处理采用自定义的$FIR$滤波器算法。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值