n/(n)^(m-1)

 import java.io.*;
import java.math.*;
import java.util.*; public class Main {
static BigInteger gcd(BigInteger a,BigInteger b)
{
if(b.equals(BigInteger.ZERO))return a;
else return gcd(b,a.mod(b));
}
public static void main(String arg[])
{
int T;
int n,m;
Scanner cin = new Scanner(System.in);
T = cin.nextInt();
while( T > 0 )
{
m = cin.nextInt();
n = cin.nextInt();
BigInteger tmp1 = BigInteger.valueOf(n);
BigInteger tmp2 = BigInteger.valueOf(m).pow(n-1);
BigInteger tt = gcd(tmp1,tmp2);
tmp1 = tmp1.divide(tt);
tmp2 = tmp2.divide(tt);
System.out.println(tmp1+"/"+tmp2);
T--;
}
}
}

hdu 4762 公式 java的更多相关文章

  1. HDU 4762 Cut the Cake(公式)

    Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  2. hdu 4762 Cut the Cake概率公式

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:一个圆形蛋糕,现在要分成M个相同的扇形,有n个草莓,求n个草莓都在同一个扇形上的概率. ...

  3. HDU 4762 Cut the Cake (2013长春网络赛1004题,公式题)

    Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  4. HDU 4762 Cut the Cake

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:将n个草莓随机放在蛋糕上,草莓被看做是点,然后将蛋糕平均切成m份,求所有草莓在同一块蛋 ...

  5. 2013长春网赛1004 hdu 4762 Cut the Cake

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题意:有个蛋糕,切成m块,将n个草莓放在上面,问所有的草莓放在同一块蛋糕上面的概率是多少.2 & ...

  6. HDU 4762 Cut the Cake(高精度)

    Cut the Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...

  7. hdu4927 Series 1(组合+公式 Java大数高精度运算)

    题目链接: Series 1 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) ...

  8. latex转word公式 java (latextoword,latex_word,latex2word,latex_omml)

    latex_word 主要目的:     给大家分享一个我的原创作品:latex转为word公式(omml)工具 [java] 此工具主要用于将含有latex公式的文本下载成word时,将latex转 ...

  9. [ACM_数学] 大菲波数 (hdu oj 1715 ,java 大数)

    大菲波数 Problem Description Fibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3.计算第n项Fibonacci数值.   ...

随机推荐

  1. Ubuntu16.04/centos7 下为chrome/firefox安装flash player插件

    为chrome安装flash: 打开终端,输入:sudo apt-get install pepperflashplugin-nonfree 或官网下载安装google-chrome-stable 为 ...

  2. 【Networking】go get 失败,代理配置

    推荐VPN: https://vpnso.com/   如果还是有问题,比如: 重新编译Git,使用openssl替换gnutls,方法如下: http://askubuntu.com/questio ...

  3. C#函数参数

    当函数接受参数时,必须指定下属内容 函数在其定义中指定参数列表,以及这些参数的类型 在每个函数调用中匹配参数列表 参数匹配:当调用函数时,必须使参数与函数定义中指定的参数完全匹配,这意味着要匹配参数的 ...

  4. SQL Server日期和时间的格式

    在SQL Server数据库中,SQL Server日期时间格式转换字符串可以改变SQL Server日期和时间的格式,是每个SQL数据库用户都应该掌握的.本文我们主要就介绍一下SQL Server日 ...

  5. Minimum Adjustment Cost

    Given an integer array, adjust each integers so that the difference of every adjacent integers are n ...

  6. C#之串口

    1.字符发送 string strSend = "00 01 02 03"; serialPort1.Write(strSend); 2.字符接收 ReadDataFromSeri ...

  7. mybaits in

    mybatis中的in: <select id="getByInventoryIds" resultMap="beanMap"> SELECT * ...

  8. 使用ssh正向连接、反向连接、做socks代理的方法

     ssh -L 219.143.16.157:58080:172.21.163.32:8080 用户名@localhost -p 10142  在 219.143.16.157机器执行   将ssh隧 ...

  9. Greedy:Subsequence(POJ 3061)

      和最短序列 题目大意:找出一个序列中比至少和S相等的最短子序列(连续的) 本来这道题可以二分法来做复杂度O(NlogN),也可以用一个类似于游标卡尺的方法O(N)来做 先来讲游标卡尺法: 因为子序 ...

  10. java获取本月或某月的第一天和最后一天

    获取某月的第一天和最后一天的日期 Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Ca ...