Cod sursa(job #1232838)

Utilizator thinkphpAdrian Statescu thinkphp Data 24 septembrie 2014 00:10:19
Problema Suma si numarul divizorilor Scor 10
Compilator c Status done
Runda Arhiva educationala Marime 0.66 kb
#include <stdio.h>
#define FIN "ssnd.in"
#define FOUT "ssnd.out"
#define LL long long

int T;
LL N;

//I'll do here a brute solution, next time one better
void readAndSolve() 
{
     LL i;

     int count, 
         sum;

     freopen(FIN, "r", stdin);

     freopen(FOUT, "w", stdout);

     scanf("%d",&T);

     for(; T; T--) {

           scanf("%lld", &N);

           sum = 0; count = 0;

           for(i = 1; i <= N; i++) {

               if(N % i == 0) count++, sum += i; 
           } 
           
           printf("%d %d\n", count, sum); 
     }
 
     fclose( stdin ); 
}

int main() 
{

    readAndSolve();    
};