0
Firstly an array look like that arr[5]={0,0,0,0,0},how i can increase the value of any index one by one?
2 odpowiedzi
+ 2
for(i=0;i<5;i++){
arr[i]=arr[i]+1;
}
0
Suppose there are N boxes numbered from 1 to N. You are filling the boxes with coins. You have Q turns and in each turn you choose two integers L and R (1 <= L <= R <= N). In each turn you put one coin in each of the boxes numbered from L to R i.e. each of the boxes numbered L, L+1, ……, R gets one coin in it. After Q turns you have to tell how many coins does each of the N boxes contains.
Input Format
First line of input contains two integer N (denoting the number of boxes) and Q ( denoting the number of turns). Next Q line contains two integers per line representing L and R for each turn. Here 1 <= N, Q <= 100.
Constraints
None
Output Format
Print the number of coins in N boxes after Q Turns.
Sample Input 0
5 3
1 3
1 5
2 4
Sample Output 0
2 3 3 2 1
Sample Input 1
4 2
1 3
3 3
Sample Output 1
1 1 2 0
Can anyone solve this?