Cod sursa(job #1035166)

Utilizator dan.ghitaDan Ghita dan.ghita Data 18 noiembrie 2013 13:04:52
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.96 kb
#include <iostream>
#include <fstream>
#include <string.h>
#include <unordered_map>
using namespace std;
int n=276997, x, k;
char s[100000000000];
ifstream f("dtcsu.in");
ofstream g("dtcsu.out");
unordered_map<long long, int> m;

void citire(){
//f>>n; f.get();

while(n--){
    f.getline(s, 100000000000); x=0;
//    long long len=strlen(s);
//    for(int i=0; i<len; ++i)
//        x=10*x+(s[i]-'0');
//    //m[x]=1;// cout<<x<<'\n';
  }
}
int verif(){
    int t=0;
while(x>1){
    t=0;

    if(x%2==0) x/=2, t=1;
    if(x%3==0) x/=3, t=1;
    if(x%5==0) x/=5, t=1;
    if(x%7==0) x/=7, t=1;
    if(x%11==0) x/=11, t=1;
    if(!t) return 0;



}





return 1;
}

int main()
{
    n=2;
    citire();
    f>>n; f.get();

while(n--){
    f.getline(s, 100000000000); x=0;
    long long len=strlen(s);
    for(int i=0; i<len; ++i)
        x=10*x+(s[i]-'0');
    if(verif()) k++;// cout<<x;

}
g<<k;//cout<<k;

    return 0;
}