📄 2902996_re.java
字号:
import java.util.*;
import java.math.*;
public class Main {
static BigInteger one = new BigInteger ("1");
public static BigInteger fact(BigInteger a)
{
if(a.intValue()==0||a.intValue()==1)
return one;
else
return a.multiply(fact(a.subtract(one)));
}
public static void main(String[] args) throws Exception {
Scanner cin = new Scanner (System.in);
BigInteger p, q, r, s, t;
int ans, tmp;
while(cin.hasNext())
{
p = cin.nextBigInteger();
q = cin.nextBigInteger();
r = cin.nextBigInteger();
s = cin.nextBigInteger();
t = p.subtract(q);
p = fact(p);
q = fact(q);
p = p.divide(q);
if(t.intValue()!=0)
{
t = fact(t);
p = p.divide(t);
}
t = r.subtract(s);
r = fact(r);
s = fact(s);
r = r.divide(s);
if(t.intValue()!=0)
{
t = fact(t);
r = r.divide(t);
}
t = p.divide(r);
ans = t.intValue();
p = p.mod(r);
p = p.multiply(new BigInteger("1000000"));
p = p.divide(r);
tmp = p.intValue();
if(tmp%10>=5)
tmp += 10;
tmp /= 10;
System.out.printf("%d.%05d\n",ans,tmp);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -