Cod sursa(job #1601181)

Utilizator alexmisto342Turdean Alexandru alexmisto342 Data 15 februarie 2016 19:49:55
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 1.02 kb
#include <fstream>
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
using namespace std;
ifstream fin("dtcsu.in");
ofstream fout("dtcsu.out");
unsigned long long int i,j,n,m,a,b,k,x,lx,ly,c,mini;
char cc[100];
string buffer;
string :: iterator it;
int ReadInt()
{

    int nr = 0;

    while ( *it < '0' || *it > '9' )
        it++;

    while ( *it >= '0' && *it <= '9' ){
        nr = nr * 10 + ( *it - '0' );
        it++;
    }

    return nr;
}
int main()
{
    getline( fin, buffer , (char) 0);
    it = buffer.begin();
    for(i = 1; i <= 276997; i++)
        a = ReadInt();
    n=ReadInt();
    for(i = 1; i <= n; i++)
    {
        a=ReadInt();
        while(a%2==0)
            a/=2;
        while(a%3==0)
            a/=3;
        while(a%5==0)
            a/=5;
        while(a%7==0)
            a/=7;
        while(a%11==0)
            a/=11;
        if(a == 1)
            m++;
    }
    fout << m;
    return 0;
}