Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- int v[11];
- int divizori(int n)
- {
- int d=2, div=0;
- while(d*d<n)
- {
- if(n%d==0)
- div+=2;
- d++;
- }
- if(d*d==n)
- div++;
- return div;
- }
- int main()
- {
- ifstream fin("ciffrecv.in");
- ofstream fout("ciffrecv.out");
- int n, MAX=0, NR_AP=0;
- for(int i=1; i<=9; i++)
- v[i]=0;
- while(fin >> n)
- {
- if(divizori(n)==0)
- v[n]++;
- }
- if(v[2]!=0)
- {
- MAX=2;
- NR_AP=v[2];
- }
- if(v[3]!=0)
- {
- MAX=3;
- NR_AP=v[3];
- }
- if(v[5]!=0)
- {
- MAX=5;
- NR_AP=v[5];
- }
- if(v[7]!=0)
- {
- MAX=7;
- NR_AP=v[7];
- }
- fout<< MAX << " " << NR_AP;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement