HDU 4762 Formula Java

Source: Internet
Author: User

n/(n) ^ (m-1)

1 ImportJava.io.*;2 Importjava.math.*;3 ImportJava.util.*;4 5  Public classMain {6     StaticBigInteger gcd (BigInteger a,biginteger b)7     {8         if(B.equals (Biginteger.zero))returnA;9         Else returngcd (B,a.mod (b));Ten     } One      Public Static voidMain (String arg[]) A     { -         intT; -         intn,m; theScanner cin =NewScanner (system.in); -T =cin.nextint (); -          while(T > 0 ) -         { +m =cin.nextint (); -n =cin.nextint (); +BigInteger TMP1 =biginteger.valueof (n); ABigInteger tmp2 = biginteger.valueof (M). Pow (n-1); atBigInteger TT =gcd (TMP1,TMP2); -TMP1 =tmp1.divide (TT); -TMP2 =tmp2.divide (TT); -System.out.println (tmp1+ "/" +tmp2); -t--; -         } in     } -}

Hdu 4762 Formula Java

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.