• [1603] Mod Three

  • 时间限制: 5000 ms 内存限制: 65535 K
  • 问题描述
  • Please help me to solve this problem, if so, LiangChen must have zhongxie!
    There is a sequence contains n integers a0, a1, ...., an, firstly all of them equal 0,
    and there are q opertions, each of them either is

    0 x; add ax by 1

    or
    1 l r; calculator the total number of ai that ai mod 3 == 0 (l <= i <= r)

  • 输入
  • Input starts with an integer T denoting the number of test cases.
    For each test case, first line contains n and q(1 <= n, q <= 100,000), next line contain n integers.
  • 输出
  • For each test case, first line contains "Case X:", then print your answer, one line contains one integer.
  • 样例输入
  • 1
    10 8
    0 4
    0 3
    0 6
    1 2 3
    0 7
    1 1 10
    0 8
    1 1 8
  • 样例输出
  • Case 1:
    1
    6
    3
  • 提示
  • 来源
  • Alex@NBUT
  • 操作

显示春菜