3164 mass factor decomposition

Source: Internet
Author: User

3164 mass factor decomposition

time limit: 1 sspace limit: 256000 KBtitle level: Golden Gold SolvingView Run ResultsTitle Description Description

(majority) give the number of T, and find out the number of its mass factor.

The data is not pit, the difficulty is reduced.

Enter a description Input Description

First line T

After T-line data

Output description Output Description

T-line decomposition results (number of mass factors)

Sample input Sample Input

2

11

6

Sample output Sample Output

1

2

Data range and Tips Data Size & Hint

11 itself is a prime number, so count into it.

By the way, hint: t<=100000. Each number is less than a long long unsigned hehe

Category labels Tags Click here to expandEnumerating Programming ability problems first, directly on the only decomposition theorem, the result wa+tle?? WA Code:
#include <cstdio>#include<iostream>#include<cmath>#include<vector>using namespacestd;#definell unsigned long long#definePir pair<ll,ll>Vector<pir>F;inlineConstll read () {Register LL x=0; RegisterCharCh=GetChar ();  while(ch<'0'|| Ch>'9') ch=GetChar ();  while(ch>='0'&&ch<='9') x=x*Ten+ch-'0', ch=GetChar (); returnx;}voidDeal (ll x) {f.clear (); ll M=floor (sqrt (x) +0.5);  for(LL i=2; i<=m;i++){        if(x%i)Continue; LL Q=0;  while(x%i==0) q++,x/=i;     F.push_back (Make_pair (i,q)); }    if(x>1) F.push_back (Make_pair (x,1)); printf ("%d\n", F.size ());}intMain () {ll t,n; T=read ();  while(t--) n=read (), Deal (n); return 0;}

violence. AC Code:
#include <iostream>using namespacestd;intMain () {Ios::sync_with_stdio (false); intTLong LongN; CIN>>T;  while(t--) {cin>>N; inttot=0;  for(intI=2; i<=n;i++){            if(n==1) Break; if(n%i==0){                 Do{n/=i; Tot++; } while(n%i==0); }} cout<<tot<<Endl; }    return 0;}

3164 mass factor decomposition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.