zoukankan      html  css  js  c++  java
  • Codeforces 1155

    1155 D

    题意

    给你 (n,x) 和一个数组 (a) ,现在你可以把 (a) 的至多一个子区间的所有元素乘上 (x) ,问 (a) 数组最终的美丽值。一个数组的美丽值为 (max(0,该数组的最大子段和))((nle 10^5,所有数le 10^9))

    Examples

    input
    5 -2
    -3 8 -2 1 -6
    output
    22
    input
    12 -3
    1 3 3 7 1 3 3 7 1 3 3 7
    output
    42
    input
    5 10
    -1 -2 -3 -4 -5
    output
    0

    显然dp。
    dp[i][0/1/2]表示枚举到第 (i) 个数,还没有使用乘法/正在使用乘法/乘法使用完毕的最大子段和。

    1155 E

    题意

    有一个多项式,次数 (le 10) ,现在你有50次询问机会,每次询问一个 (x) 返回 (f(x)) ,要你求出该多项式的零点。保证有且只有一个。(\% 1000003) 意义下进行 ((0le 所有数le 1000002))

    Examples

    input

    1000002

    0
    output
    ? 0

    ? 1

    ! 1
    input

    5

    2

    1

    output
    ? 2

    ? 1

    ? 0

    ! -1

    先询问11次把这个多项式的表达式弄出来(高斯消元/拉格朗日/其它乱搞),然后暴力0~1000002往里代即可。

  • 相关阅读:
    Spark API 之 map、mapPartitions、mapValues、flatMap、flatMapValues详解
    大三寒假生活9
    大三寒假生活8
    大三寒假生活7
    MySQL SQL DML (数据操作语言)
    MySQL JOIN
    Python 可执行对象
    Python __slots__
    Python tempfile (临时文件)
    Python 文件操作
  • 原文地址:https://www.cnblogs.com/BlogOfchc1234567890/p/10806137.html
Copyright © 2011-2022 走看看