Pagini recente » Monitorul de evaluare | Cod sursa (job #2309301) | Cod sursa (job #21444) | Cod sursa (job #3213894) | Cod sursa (job #470780)
Cod sursa(job #470780)
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std ;
const long long MAXN = 10000000 ;
const int MODULO = 9973 ;
bool ratostene [ MAXN ] ;
long long n , limita , produs , t ;
long long vector [ 11 ] ;
long long polinom ( int X , int d )
{
long long f = 1 ;
for ( int i = 1 ; i <= d ; ++ i )
{
f = f * X + 1 ;
f % MODULO ;
}
return f ;
}
void ciurRatostene ( )
{
for ( long long i = 2 ; i <= limita ; ++i )
{
if ( ! ratostene [ i ] )
{
for ( long long j = 2 * i ; j <= limita ; j += i )
ratostene [ j ] = true ;
}
}
}
int main ( )
{
freopen("ssnd.in","r",stdin);
freopen("ssnd.out","w",stdout);
long long max = 0 ;
cin >> t ;
for ( int i = 1 ; i <= t ; i ++ )
{
cin >> vector [ i ] ;
if ( vector [ i ] > max )
max = vector [ i ] ;
}
produs= 1 ;
long long S = 1 ;
limita = sqrt( max ) + 1 ;
ciurRatostene ( ) ;
//for ( long long i = 1 ; i <= n ; ++ i )
//cout << ratostene [ i ] << " " ;
cout << endl ;
for ( int k = 1 ; k <= t ; ++k )
{
S = 1 ;
produs = 1 ;
n = vector [ k ] ;
limita = sqrt ( n ) + 1 ;
for ( long long i = 2 ; i <= limita ; ++i )
{
if ( ratostene [ i ] == false )
{
if ( ( n % i ) == 0 )
{
long long putere = 0 ;
//cout << i << " " ;
while ( n % i == 0 )
{
putere ++ ;
n = n / i ;
}
produs = produs * polinom ( i , putere ) ;
produs %= MODULO ;
S *= ( putere + 1 ) ;
}
}
}
if ( n > 1 )
{
produs = produs * polinom ( n , 1 ) ;
produs %= MODULO ;
S *= 2;
}
cout << S << " " ;
cout << produs << endl ;
}
return 0 ;
}