Cod sursa(job #1030178)

Utilizator ionutzmarcFMI ilie ionut ionutzmarc Data 15 noiembrie 2013 15:54:50
Problema Dtcsu Scor 0
Compilator c Status done
Runda FMI No Stress 4 Marime 0.82 kb
#include <stdio.h>
#include <stdlib.h>

int main()
{      int n,i,k,a=0,b;
      FILE *f = fopen("dtcsu.in", "r");
    FILE *g = fopen("dtcsu.out", "w");
     //for(i=1;i<=276997;i++)
       // fscanf(f, "%d", &n);
     fscanf(f, "%d", &n);
     for(i=1;i<=n;i++)
     {
         fscanf(f, "%d", &k);
         b=1;
         while(k!=1&&b!=0){
                b=0;
            if(k%2==0)
                {k=k/2;
            b=1;}
            if(k%3==0)
                {k=k/3;
              b=1;}
            if(k%5==0)
                {k=k/5;
              b=1;}
            if(k%7==0)
                {k=k/7;
               b=1;}
            if(k%11==0)
                {k=k/11;
             b=1;}
         }
         if(k==1)
            a++;



     }
     printf("%d",a);





    return 0;
}