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数值. ...
随机推荐
- Hibernate 多对多关联查询条件使用
from Brand as b inner join fetch b.styles as s where s.styleId=?
- htpasswd命令
htpasswd命令是Apache的Web服务器内置工具,用于创建和更新储存用户名.域和用户基本认证的密码文件. 语法 htpasswd(选项)(参数) 选项 -c:创建一个加密文件:-n:不更新加密 ...
- 打印log
入口文件 //日志记录配置 if (!defined('DS')) { define('DS', '/'); } if(!defined('APP_PATH_LOG')){ define('APP_P ...
- Increasing Triplet Subsequence
Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the ar ...
- 【leetcode】Symmetric Tree
Symmetric Tree Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its ...
- SQL Server 流程控制
流程控制语句: BEGIN ... END WAITFOR GOTO WHILE IF ... ELSE BREAK RETURN CONTINURE 1.BEGIN ... END BEGIN ...
- C# Winfrom 页面传值
2个窗体 Parent,Children 代码: Parent public partial class Parent : Form { public string parentValue = &qu ...
- Delphi XE5 常见问题解答
Delphi XE5 常见问题解答 有关于新即时试用的问题吗?请看看 RAD Studio 即时试用常见问答. 常见问题 什么是 Delphi? Embarcadero? Delphi? XE5 是易 ...
- ffmpeg-20160628-git-bin.7z
ESC 退出 0 进度条开关 1 屏幕原始大小 2 屏幕1/2大小 3 屏幕1/3大小 4 屏幕1/4大小 S 下一帧 [ -2秒 ] +2秒 ; -1秒 ' +1秒 下一个帧 -> -5秒 f ...
- DataStage
parallel job shell调用:dsjob ./dsjob -run -mode NORMAL -paramfile xxx.param <PROJECT> <JOB> ...