We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
intmain(){/* Enter your code here. Read input from STDIN. Print output to STDOUT */intp[]={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101};intq;cin>>q;for(inti=0;i<q;++i){unsignedlonglongcurrent;cin>>current;if(current==1){cout<<0<<endl;continue;}unsignedlonglongtemp=1;intposition=-1;intcounter=-1;do{counter++;position++;temp*=p[position];}while(temp<=current);cout<<counter<<endl;}return0;}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Leonardo's Prime Factors
You are viewing a single comment's thread. Return to all comments →
Here is my solution for better understanding :