300639: CF121E. Lucky Array
Memory Limit:256 MB
Time Limit:4 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Lucky Array
题意翻译
## 题目描述 Petya 喜欢幸运数,幸运数只包含 4 和 7 这两个数字。例如 47,744,4 都是幸运数字,但 5,16,467 不是。 Petya 有一个 N 个数的数组,他想给这个数组执行 M 个操作,可以分为两种操作: 1. `add l r d` 把第 l 到 第 r 个数都加上 d; 9 2. `count l r` 统计第 l 到第 r 个数有多少个幸运数字。 请你编一个程序来执行这些操作。 $1 \leq N,M \leq 10^5\ ,\ 1 \leq l \leq r \leq N\ ,\ 1 \leq d \leq 10^4$ ## 输入格式 第一行,两个数 N 和 M; 第二行,N 个数,表示原数组; 接下来 M 行,每行表示一个操作,格式见题目描述。 ## 输出格式 对于每个询问幸运数个数的问题,输出答案,每个占一行。 _输入输出样例在下面_ ## 说明 对于第一个样例: 1. 执行了`add 1 3 2`操作之后变成:`4 5 6` 2. 执行了`add 2 3 3`操作之后变成:`4 8 9` 对于第二个样例: 1. 执行了`add 1 4 3`之后变成:`7 7 7 7` 2. 执行了`add 2 3 40`之后变成:`7 47 47 7` 感谢@突然颓废 提供翻译题目描述
Petya loves lucky numbers. Everybody knows that lucky numbers are positive integers whose decimal representation contains only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not. Petya has an array consisting of $ n $ numbers. He wants to perform $ m $ operations of two types: - add $ l $ $ r $ $ d $ — add an integer $ d $ to all elements whose indexes belong to the interval from $ l $ to $ r $ , inclusive $ (1<=l<=r<=n,1<=d<=10^{4}) $ ; - count $ l $ $ r $ — find and print on the screen how many lucky numbers there are among elements with indexes that belong to the interval from $ l $ to $ r $ inclusive $ (1<=l<=r<=n) $ . Each lucky number should be counted as many times as it appears in the interval. Petya has a list of all operations. The operations are such that after all additions the array won't have numbers that would exceed $ 10^{4} $ . Help Petya write a program that would perform these operations.输入输出格式
输入格式
The first line contains two integers $ n $ and $ m $ ( $ 1<=n,m<=10^{5} $ ) — the number of numbers in the array and the number of operations correspondingly. The second line contains $ n $ positive integers, none of which exceeds $ 10^{4} $ — those are the array numbers. Next $ m $ lines contain operations, one per line. They correspond to the description given in the statement. It is guaranteed that after all operations are fulfilled each number in the array will not exceed $ 10^{4} $ .
输出格式
For each operation of the second type print the single number on the single line — the number of lucky numbers in the corresponding interval.
输入输出样例
输入样例 #1
3 6
2 3 4
count 1 3
count 1 2
add 1 3 2
count 1 3
add 2 3 3
count 1 3
输出样例 #1
1
0
1
1
输入样例 #2
4 5
4 4 4 4
count 1 4
add 1 4 3
count 1 4
add 2 3 40
count 1 4
输出样例 #2
4
4
4