Samba(Rice) can be grown in rectangular patches of any side lengths. However, The owner only has a limited amount of land. Consider the entire town to be consisting of cells in a rectangular grid of positive coordinates. The owner own all cells (x,y) that satisfy x ∗ y ≤ N
As an example if N=4, The owner owns the following cells:
(1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(3,1),(4,1)
The owner can only grow samba in rectangular patches consisting only of cells which belong to him.
Also, if he uses a cell, he must use it entirely. He cannot use only a portion of it.
Input:
The first line of the input contains T, the number of test cases.
The next T lines of input contains one integer N.
Output:
Print the output the number of unique patches of rectangular land that he can grow samba in!
Since this number can be very large, output it modulo 1000000007.
#include <stdio.h> #define M 1000000007 #define data long int int find(int num) { int i,j,sum=0; for(i=1;i<=num;i++) { for(j=1;j<=num;j++) {if(i*j<=num) { sum+=(i*j);} } } return sum; } int main() { int t,num,sum; scanf("%d",&t); while(t--) { scanf("%d",&num); sum=find(num); printf("%d\n",sum);} return 0; }
INPUT_1:
5
11
7
10
4
19
OUTPUT:
192
71
170
23
666
INPUT_2:
8
17
41
3
15
10
21
33
16
OUTPUT:
520
3719
11
406
170
870
2335
486
Morae Q!
- Find the number of strings made by using each alphabet as starting character.
- Find the Pythagorean triplet.
- Find out what is the minimum possible energy he needs to spend.
- Sort the array in non-decreasing order and print out the original indices of sorted array.
- Compute the number of landmasses on the planet after all the meteorites have fallen.
- Give the appropriate server status as output.
- Regular expressions (Regex) using search module in python.
- Find the minimum distance between any pair of equal elements in the array.
- Find the total number of matching pairs of socks that are available.
- Find the total number of teams which can work together and cannot work together.
- Given the heights of all the boys and girls tell whether it is possible for all boys to get a girl.
- Find the sequence of cities to visit according to coordinates and conditions.
- Find the number of unique patches of rectangular land to grow samba(rice) in.
- Regular expression Regex matching strings.
- Generate a greeting quote for admin.
- Find all the cavities on the map and replace their depths with the character X.
- Check whether the given graph is Bipartite or not.
- Find the status of the passengers and safari cars at zoo after k units of time.
- Determine the chair number occupied by the child who will receive that chocolate.
- Check if Rubik’s cube of any dimensions can be assembled.