JZ number of junior and 1 OJ 1087. about

Title Description

Give you a number N, you need to calculate the number of all about the numbers and. (Divisor of N refers to an integer N is divisible), for example, about several 12 has 1,2,3,4,6,12. Therefore divisors of 1 + 2 + 3 + 4 + 6 + 12 = 28
 

Entry

The title plurality of sets of data, the first row of a T (T equal to less than 1000), it indicates that the data group T, T the following lines, each a positive integer N (N is equal to less than 100,000) represents the number to be treated.

Export

T lines, each represents a positive integer divisor of the number and the corresponding input.
 

Sample input

1
12

Sample Output

28
 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 { 
 5     register long long int n,i,j,num,ans=0;
 6     cin>>n;
 7     for(i=1;i<=n;i++){
 8         cin>>num;
 9         for(j=1;j<=num;j++){
10             if(num%j==0){
11                 ans+=j;
12             }
 13          }
 14          cout << age << endl;
15          years = 0 ;
16      }
 17 }

Guess you like

Origin www.cnblogs.com/anbujingying/p/11323667.html