hdu 4762 公式 java
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的更多相关文章
- HDU 4762 Cut the Cake(公式)
Cut the Cake Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
- hdu 4762 Cut the Cake概率公式
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:一个圆形蛋糕,现在要分成M个相同的扇形,有n个草莓,求n个草莓都在同一个扇形上的概率. ...
- 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 ...
- HDU 4762 Cut the Cake
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题目大意:将n个草莓随机放在蛋糕上,草莓被看做是点,然后将蛋糕平均切成m份,求所有草莓在同一块蛋 ...
- 2013长春网赛1004 hdu 4762 Cut the Cake
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4762 题意:有个蛋糕,切成m块,将n个草莓放在上面,问所有的草莓放在同一块蛋糕上面的概率是多少.2 & ...
- HDU 4762 Cut the Cake(高精度)
Cut the Cake Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Tota ...
- hdu4927 Series 1(组合+公式 Java大数高精度运算)
题目链接: Series 1 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) ...
- latex转word公式 java (latextoword,latex_word,latex2word,latex_omml)
latex_word 主要目的: 给大家分享一个我的原创作品:latex转为word公式(omml)工具 [java] 此工具主要用于将含有latex公式的文本下载成word时,将latex转 ...
- [ACM_数学] 大菲波数 (hdu oj 1715 ,java 大数)
大菲波数 Problem Description Fibonacci数列,定义如下:f(1)=f(2)=1f(n)=f(n-1)+f(n-2) n>=3.计算第n项Fibonacci数值. ...
随机推荐
- IDEA 编译找不到符号,文件却没有错误。
单独编译提交找不到符号的文件. DIEAA
- redis配置文件redis.conf参数说明
redis配置文件redis.conf参数说明 (2013-01-09 21:20:40)转载▼ 标签: redis配置 redis.conf 配置说明 杂谈 分类: nosql # By defau ...
- 【K8s】Kubernetes 最近正在看的资料
中国移动Kubernetes多集群统一管理实践: http://www.tuicool.com/articles/FrqQrqI#c-22517 一种新的进入容器的方式: WebSocket + D ...
- springboot 整合Redis
0.导入 maven依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifact ...
- HTTP 格式
HTTP请求报文和HTTP响应报文 HTTP报文是面向文本的,报文中的每一个字段都是一些ASCII码串,各个字段的长度是不确定的.HTTP有两类报文:请求报文和响应报文. HTTP请求报文 一个HTT ...
- VS中计算程序运行时间
VS中计算程序运行的时间 http://bbs.csdn.net/topics/39068881 有时候在设计程序完了之后需要计算程序运行的时间. 这时候可以使用Windows的库函数 GetIi ...
- Spring AOP基于配置文件的面向方法的切面
Spring AOP基于配置文件的面向方法的切面 Spring AOP根据执行的时间点可以分为around.before和after几种方式. around为方法前后均执行 before为方法前执行 ...
- JS 循环练习
规律 大范围套小范围 循环 分支语句 switch case 嵌套 死循环 while(true) 打破循环 break continue while(true) ...
- 【python】dict4ini和xmltodict模块用途
dict4ini模块:可以读写配置文件 xmltodict模块:将xml和json互相转换 https://pypi.python.org/pypi/xmltodict
- IOS - delegate为什么不使用retain
循环引用所有的引用计数系统,都存在循环应用的问题.例如下面的引用关系: 对象a创建并引用了对象b.对象b创建并引用了对象c.对象c创建并引用了对象b. 这时候b和c的引用计数分别是2和1.当a不再使用 ...