Cod sursa(job #1030374)

Utilizator ioalexno1Alexandru Bunget ioalexno1 Data 15 noiembrie 2013 16:17:34
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda FMI No Stress 4 Marime 0.66 kb
#include <cstdio>
#include <cstdlib>

using namespace std;

long long x;

int main(){
    freopen("dtcsu.in","r",stdin);
    
    char *sir;
   for( int i = 1; i <= 276997; ++i )
        gets(sir);
    int q;
    scanf( "%d", &q );
    int sol = 0;
    for(; q >= 1; --q ){
        
        scanf( "%lld", &x);
        if ( x == 0 ) x = -1;
        while( x % 2 == 0) x/= 2;
        while( x % 3 == 0) x/= 3;
        while( x % 5 == 0) x/= 5;
        while( x % 7 == 0) x/= 7;
        while( x % 11 == 0) x /= 11;
        if( x == 1 ) ++sol;        
    
    }
    freopen( "dtcsu.out", "w", stdout);
    printf( "%d", sol);
    fclose(stdin);
    fclose(stdout);
    return 0;
}