Factorial Factorization (1)

Source: Internet
Author: User
Factorial Factorization (1)

Description

Given two numbers m, n, where M is a prime number.

Returns the factorial of N (0 <= n <= 10000) to calculate the number of M.

Input
The first row is an integer S (0 <S <= 100), indicating the next s row of the test data group. Each row has two integers n, m.
Output
Number of output M.
Sample Input
2100 516 2
Sample output
2415

# Include <iostream> using namespace STD; int main () {int N; int M1, M2; int sum, I = 0; CIN> N; while (n --) {CIN> m1> m2; sum = 0; do {I = m1/m2; sum + = I; M1 = I;} while (M1> = m2 ); cout <sum <Endl;} return 0 ;}

 

Factorial Factorization (1)

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.