首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏饶文津的专栏

    【CodeForces 577B】Modulo Sum

    给你n(1 ≤ n ≤ 106)个数a1..an(0 ≤ ai ≤ 109),再给你m( 2 ≤ m ≤ 103)如果n个数的子集的和可以被m整除,则输出YES,否则NO。

    49710发布于 2020-06-02
  • 来自专栏数据结构与算法

    agc027D - Modulo Matrix(构造 黑白染色)

    构造一个$n * n$的矩阵,要求任意相邻的两个数$a,b$,使得$max(a,b) % min(a,b) \not = 0$

    43030发布于 2018-09-30
  • 来自专栏一个会写诗的程序员的博客

    关于实用可满足性模理论(SMT)求解 Practical Satisfiability Modulo Theories (SMT) Solving

    In computer science and mathematical logic, the satisfiability modulo theories (SMT) problem is a decision https://en.wikipedia.org/wiki/Satisfiability_modulo_theories

    80820编辑于 2022-03-07
  • 来自专栏自然语言处理(NLP)论文速递

    ASU | 提出LLM-Modulo框架,可充分发挥LLMs潜力!

    为此,作者还提出了一个新的LLM-Modulo框架,这个框架把大型语言模型和一些外部的验证工具结合起来,使LLMs在规划任务中发挥了重要作用。 为此,「本文提出了LLM-Modulo框架,就是想解决如何正确利用LLMs的挑战,让它们在不夸大能力的前提下,发挥出最大的作用」。 LLM-Modulo 基于以上理解,本文作者提出了LLM-Modulo框架(如下图所示),旨在结合LLMs的长处和外部基于模型的验证器的优势,通过更紧密的双向交互机制,使LLMs在规划任务中发挥更有意义的角色 LLM-Modulo框架的一个关键优势是它「支持人机协作」。领域专家在整个过程中发挥着至关重要的作用,他们的知识用于指导和细化LLM生成的规划,确保规划符合实际需求和约束。 作者认为这些模型自己是不会规划的,但是它们能够提供辅助,特别是在LLM-Modulo框架中,LLMs能提供关联知识,还能提出一些可能的计划。

    79710编辑于 2024-03-25
  • 来自专栏Michael阿明学习之路

    LeetCode 5994. 查找给定哈希值的子串(字符串哈希)

    给你一个字符串 s 和整数 power,modulo,k 和 hashValue 。 请你返回 s 中 第一个 长度为 k 的 子串 sub ,满足 hash(sub, power, modulo) == hashValue 。 测试数据保证一定 存在 至少一个这样的子串。 示例 1: 输入:s = "leetcode", power = 7, modulo = 20, k = 2, hashValue = 0 输出:"ee" 解释:"ee" 的哈希值为 hash("ee" 提示: 1 <= k <= s.length <= 2 * 10^4 1 <= power, modulo <= 10^9 0 <= hashValue < modulo s 只包含小写英文字母。 )+26*modulo)%modulo return "" if pos==-1 else s[pos:pos+k] 256 ms 15.2 MB Python3 ---- 我的

    2.3K20编辑于 2022-03-10
  • 来自专栏算法修养

    LeetCode weekly contest 278 (amazon pay)

    num2[0]=1; for(int i=1;i<k;i++) { num2[i] = ((power % modulo ) * (num2[i-1] %modulo)) %modulo; } for(int i=n-1;i>= n-k;i--) { res += s[i]; ans += (num[i] * num2[k + i - n])%modulo; ans %= modulo )); ans -= (num[i+k] * num2[k-1])%modulo; ans+= 2*modulo; ans %= modulo; ans *= (power % modulo); ans %= modulo;

    43120编辑于 2022-03-10
  • 来自专栏仙士可博客

    int转字符串实现方法

    number > 61){             $dividend = ($number + 1);             while ($dividend > 0){                 $modulo  = ($dividend - 1) % 62;                 if($modulo < 0){                     $modulo = 62+$modulo;                  }                 $alpha = self::alphabet[$modulo] .  $alpha;                 $dividend = floor((($dividend - $modulo) / 62));             }         }         

    1.2K10发布于 2021-03-03
  • 来自专栏LoRexxar's Blog

    HCTF2018智能合约两则Writeup

    uint betnumber; // Modulo of a game. uint8 modulo; // Block number of placeBet tx. <= MAX_MASK_MODULO, // [0, betMask) for larger modulos. // modulo - game modulo. require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range."); require (betMask bet.betnumber = betnumber; bet.modulo = uint8(modulo); bet.placeBlockNumber = uint40(block.number uint betnumber = bet.betnumber; uint mask = bet.mask; uint modulo = bet.modulo; uint placeBlockNumber

    52710编辑于 2023-02-21
  • 来自专栏Seebug漏洞平台

    智能合约游戏之殇——Dice2win安全分析

    uint amount = msg.value; require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within <= MAX_MASK_MODULO) { // Small modulo games specify bet outcomes via bit mask. rollUnder = ((betMask * POPCNT_MULT) & POPCNT_MASK) % POPCNT_MODULO; mask = betMask; require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo."); bet.amount = amount; bet.modulo = uint8(modulo); bet.rollUnder = uint8(rollUnder);

    86010发布于 2018-11-05
  • 来自专栏我的充电站

    LeetCode笔记:Weekly Contest 278

    代码实现 给出python代码实现如下: class Solution: def subStrHash(self, s: str, power: int, modulo: int, k: int p = [1 for _ in range(k)] for i in range(k-1): p[i+1] = (p[i] * power) % modulo hashval = 0 for i in range(k): hashval = (hashval + p[k-1-i] * encode(n-1-i)) % modulo range(n-k-1, -1, -1): hashval = ((hashval - encode(i+k) * p[-1]) * power + encode(i) + modulo ) % modulo if hashval == hashValue: res = s[i:i+k] return res 提交代码评测得到

    30620编辑于 2022-04-13
  • 来自专栏LoRexxar's Blog

    智能合约游戏之殇——Dice2win安全分析

    Dice2win安全性分析 选择中止攻击 让我们来回顾一下dice2win的代码 function placeBet(uint betMask, uint modulo, uint commitLastBlock uint amount = msg.value; require (modulo > 1 && modulo <= MAX_MODULO, "Modulo should be within range <= MAX_MASK_MODULO) { // Small modulo games specify bet outcomes via bit mask. // rollUnder require (betMask > 0 && betMask <= modulo, "High modulo range, betMask larger than modulo."); bet.amount = amount; bet.modulo = uint8(modulo); bet.rollUnder = uint8(rollUnder); bet.placeBlockNumber

    67410编辑于 2023-02-21
  • 来自专栏yuyy.info技术专栏

    【SpringCloud】五、Ribbon

    * * @param modulo The modulo to bound the value of the counter. . */ private int incrementAndGetModulo(int modulo) { for (;;) { int current = nextServerCyclicCounter.get(); int next = (current + 1) % modulo; if (nextServerCyclicCounter.compareAndSet IClientConfig clientConfig) { } } choose(ILoadBalancer lb, Object key) 选择服务节点 incrementAndGetModulo(int modulo

    48610编辑于 2022-06-28
  • 来自专栏开源优测

    python unittest之异常测试

    test_raise_regexp(self): self.assertRaisesRegexp( ZeroDivisionError, "integer division or modulo test in 0.001s OK 我们修改下除数,把 self.assertRaisesRegexp( ZeroDivisionError, "integer division or modulo by zero", div, 2, 0) 改为: self.assertRaisesRegexp( ZeroDivisionError, "integer division or modulo test_raise_regexp.py", line 19, in test_raise_regexp ZeroDivisionError, "integer division or modulo

    2.2K60发布于 2018-04-04
  • 来自专栏前端工程

    深入剖析vscode工具函数(九)数字相关处理

    rot函数 rot 理论上应该代表的是旋转的含义,vscode实现这个函数,本质上是取模运算: export function rot(index: number, modulo: number): number { return (modulo + (index % modulo)) % modulo; } 比如,调用了rot(5, 3),返回的是2,因为5%3=2 。 这里为什么不直接返回index % modulo呢?主要还要考虑负数的情况。比如rot(-1, 5) ,实际上返回的是4 ,表示倒数第一个。

    40520编辑于 2023-10-31
  • 来自专栏全栈程序员必看

    poj 1845(等比数列前n项和及高速幂)

    Determine S modulo 9901 (the rest of the division of S by 9901). Output The only line of the output will contain S modulo 9901. Their sum is 15. 15 modulo 9901 is 15 (that should be output).

    37310编辑于 2022-07-10
  • 来自专栏嵌入式开发圈

    分享两个C库源码中的移位函数

    register unsigned num = val; /* number to rotate */ shift &= 0x1f; /* modulo register unsigned num = val; /* number to rotate */ shift &= 0x1f; /* modulo register unsigned num = val; /* number to rotate */ shift &= 0x1f; /* modulo register unsigned num = val; /* number to rotate */ shift &= 0x1f; /* modulo

    1.4K20发布于 2020-07-01
  • 来自专栏可以叫我才哥

    itertools拼装迭代器与生成器

    values) print('sum_reduce:'.ljust(20), list(sum_reduce)) # 函数的定义是2个值相加,输出该值对20取模(除以20后的余数) def sum_modulo _20(first, second): output = first + second return output % 20 modulo_reduce = itertools.accumulate (values, sum_modulo_20) print('modulo_reduce:'.ljust(20), list(modulo_reduce)) sum_reduce: [1, 3, 6, 10, 15, 21, 28, 36, 45, 55] modulo_reduce: [1, 3, 6, 10, 15, 1, 8, 16, 5, 15] product

    68020发布于 2021-08-05
  • 来自专栏Python小屋

    Python代码调试之异常回溯

    call last): File "<pyshell#25>", line 1, in <module> 1/0 ZeroDivisionError: integer division or modulo 2, in B A() File "<pyshell#28>", line 2, in A 1/0 ZeroDivisionError: integer division or modulo sys.exc_info() print(r) (<type 'exceptions.ZeroDivisionError'>, ZeroDivisionError('integer division or modulo

    1.4K30发布于 2018-04-17
  • 来自专栏C++核心准则原文翻译

    C++核心准则ES.101:使用无符号类型进行位操作

    0b1010'1010; unsigned char y = ~x; // y == 0b0101'0101; Note(注意) Unsigned types can also be useful for modulo However, if you want modulo arithmetic add comments as necessary noting the reliance on wraparound behavior

    47120发布于 2020-06-17
  • 来自专栏Android点滴分享

    汇编学习(4), 整数,栈,浮点

    multi db "The product is",0 divi db "The integer quotient is",0 remi db "The modulo is",0 section .bss resulti resq 1 modulo resq 1 section .text 0 ; rdx needs to be 0 before idiv idiv qword [number2] ; divide rax by number2, modulo in rdx mov [resulti], rax mov [modulo], rdx ; rdx to modulo ; displaying the result Number 1 Shift right 2 (/4) with sign extension: -3 The product is 2432 The integer quotient is 6 The modulo

    49020编辑于 2022-12-07
领券