Multiples Of 3
There are N numbers(indexed from 1 to N) initially all are 0.Input Format
You have to perform Q operations of two types:
1. 1 A B: increase all numbers in range from index A to B by 1.
2. 2 A B: count how many numbers in range from index A to B are divisible by 3.
First line contains one integer NOutput Format
Second line contains one integer Q
following Q lines contains queries of format either :
1 A B or
2 A B
for all query of type 2 A B print in seperate lines count of numbers.Question Video
1. 1 <= N <= 10^5Sample Input
2. 1 <= A <= B <= N
4Sample Output
7
2 1 4
1 2 3
1 2 4
2 1 1
1 1 4
2 4 4
2 1 4
4
1
0
2
-
Asked in Companies
-
Related Topics
Video Solution
Code Solution
{ }
{ }
Run