果然,或滥用零件,啥都不说了。我们欣慰地学习阅读。这两天残疾儿童是数学。

这是求所需的问题,不明确。贴上官方的解题报告。

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvbGluMzc1NjkxMDEx/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" align="middle" alt="">



留着慢慢研究    。



好吧看到其它人写的发现有自带函数。就再贴一个新的。

就得在最以下:

import java.math.BigInteger;
import java.util.Scanner; public class Main {
static BigInteger [][] c = new BigInteger[110][110];
public static void del() {
for(int i = 0; i <= 105; i ++)
c[i][0] = c[i][i] = BigInteger.ONE;
for(int i = 1; i <= 105; i ++)
{
for(int j = 1; j < i; j ++)
c[i][j] = (c[i-1][j-1] .add(c[i-1][j]));
}
}
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int d;
BigInteger n=BigInteger.ZERO,up=BigInteger.ZERO,down=BigInteger.ZERO,temp=BigInteger.ZERO;
del();
while(cin.hasNext())
{
n=cin.nextBigInteger();
d=cin.nextInt();
up=c[d][2].multiply(n.add(BigInteger.valueOf(4)).pow(2));
down=BigInteger.valueOf(9).multiply(n.pow(d));
if(up.compareTo(down)==0)
{
System.out.println(1);
}
else {
temp=up.gcd(down);
System.out.println(up.divide(temp)+"/"+down.divide(temp));
}
}
cin.close();
}
}





以下是代码(旧):

import java.math.BigInteger;
import java.util.Scanner; public class Main {
static BigInteger [][] c = new BigInteger[110][110];
public static void del() {
for(int i = 0; i <= 105; i ++)
c[i][0] = c[i][i] = BigInteger.ONE;
for(int i = 1; i <= 105; i ++)
{
for(int j = 1; j < i; j ++)
c[i][j] = (c[i-1][j-1] .add(c[i-1][j]));
}
}
public static BigInteger gcd(BigInteger a ,BigInteger b) {
if(a .compareTo(b)<0)
return gcd(b,a);
if(a .mod(b).compareTo(BigInteger.ZERO)== 0)
return b;
return gcd(b, a.mod(b));
}
public static BigInteger pow(BigInteger a ,int b) {
BigInteger ans = BigInteger.ONE;
for(int i=1;i<=b;i++)
{
ans=ans.multiply(a);
}
return ans;
}
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int d;
BigInteger n=BigInteger.ZERO,up=BigInteger.ZERO,down=BigInteger.ZERO,temp=BigInteger.ZERO;
del();
while(cin.hasNext())
{
n=cin.nextBigInteger();
d=cin.nextInt();
up=c[d][2].multiply(pow(n.add(BigInteger.valueOf(4)),2));
down=BigInteger.valueOf(9).multiply(pow(n, d));
if(up.compareTo(down)==0)
{
System.out.println(1);
}
else {
temp=gcd(up, down);
System.out.println(up.divide(temp)+"/"+down.divide(temp));
}
}
cin.close();
}
}

版权声明:本文博客原创文章。博客,未经同意,不得转载。

【2014 Multi-University Training Contest 2 1002】/【HDU 4873】 ZCC Loves Intersection的更多相关文章

  1. 2018 Multi-University Training Contest 1 Distinct Values 【贪心 + set】

    任意门:http://acm.hdu.edu.cn/showproblem.php?pid=6301 Distinct Values Time Limit: 4000/2000 MS (Java/Ot ...

  2. HDU 2018 Multi-University Training Contest 1 Triangle Partition 【YY】

    传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6300 Triangle Partition Time Limit: 2000/1000 MS (Java ...

  3. HDU 6351.Beautiful Now-暴力、全排列、思维 (2018 Multi-University Training Contest 5 1002)

    2018 Multi-University Training Contest 5 6351.Beautiful Now 题意就是交换任意两个数字,问你交换k次之后的最小值和最大值. 官方题解: 哇塞, ...

  4. HDU 6333.Problem B. Harvest of Apples-组合数C(n,0)到C(n,m)求和-组合数学(逆元)+莫队 ((2018 Multi-University Training Contest 4 1002))

    2018 Multi-University Training Contest 4 6333.Problem B. Harvest of Apples 题意很好懂,就是组合数求和. 官方题解: 我来叨叨 ...

  5. 【HDU 2014 Multi-University Training Contest 1 1002】/【HDU 4862】Jump

    多校训练就这么华丽丽的到了 ,于是乎各种华丽丽的被虐也開始了. 这是多校的1002; 最小费用最大流. 题目大意: 有n*m个方格,每一个方格都一个的十进制一位的数.你能够操作K次. 对于每一次操作, ...

  6. 【2014 Multi-University Training Contest 3 1002】/【HDU 4888】 Redraw Beautiful Drawings

    不easy啊.最终能够补第二个题了.! 顺便说一句:模版写残了就不要怪出题人啊 ~ (这残废模版研究了好长时间才找出错) 题目大意: 有一个n*m的矩阵.每个格子里都将有一个数.给你每一行数字之和和每 ...

  7. 2015 Multi-University Training Contest 2 1002 Buildings

    Buildings Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=5301 Mean: n*m列的网格,删除一个格子x,y,用矩形 ...

  8. 2015 Multi-University Training Contest 1 - 1002 Assignment

    Assignment Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=5289 Mean: 给你一个数列和一个k,求连续区间的极值之 ...

  9. hdu6351 2018 Multi-University Training Contest 5 1002 Beautiful Now

    题意: 给出一个十进制数,数位两两可以交换,给出最多能交换多少次,以及交换后的数不能有前缀0,问能形成最小和最大的数 * * * 尝试的思路 贪心,将字符串先排出最大以及最小的情况,然后按一定顺序将对 ...

随机推荐

  1. Git双机同步

    如果使用git init 初始化,当客户端仓库push内容时,服务器端仓库可以看到log,但是更新的文件不能显示,必须使用git reset --hard才能更新内容

  2. 对ORA-01795: 列表中的最大表达式数为 1000的处理(算法:计算数量及切割)

    /** * @category  * 原:strIDs in ( 100001,100002,100003,....................,110001,120001,130001,1400 ...

  3. php函数serialize()与unserialize() 数据序列化与反序列化

    php函数serialize()与unserialize()说明及案例.想要将已序列化的字符串变回 PHP 的值,可使用unserialize().serialize()可处理除了resource之外 ...

  4. iOS国际化和genstrings所有子文件夹本地化字符串

    iOS国际化和genstrings所有子文件夹本地化字符串 在最近的一个繁忙的对外工程.每天加班.没有时间更新博客.简单谈一下知识的国际化. 首先,我们使用串.必须NSLocalizedString( ...

  5. [Network]Application Layer

    1 Principles of Network Applications 1.1 Application Architectures Client-Server Peer-to-Peer Hybird ...

  6. 记View跨界平局

    <?xml version="1.0" encoding="utf-8"? > <RelativeLayout xmlns:android=& ...

  7. VS2010中使用CL快速 生成DLL的方法

    方案一: 1.命令行中输入cl example.cpp,生成example.obj和example.lib文件.有可能还会提示“没有入口点”的错误.这是因为我们的CPP中是要生成dll文件的,并没有m ...

  8. 桥模式设计模式进入Bridge

    Abstraction:抽象部分的父类,定义须要实现的接口. 维护对实现部分的引用,从而把实现桥接到Implementor中去 Implementor:实现部分的接口 RefinedAbstracti ...

  9. [C/C++]_[VS2010来源与UTF8中国字符串转码ANSI问题]

    现场: 1.思想vs设置源文件UTF8编码,代码中国串出现在它必须是utf8编码,不幸的是,,假定源代码将出现在中国字符串,在存储器中转码ANSI编码. Unicode(UTF8签名) 代码页(650 ...

  10. 模板引擎mustache.js

    Javascript模板引擎mustache.js详解   阅读目录 1. 从一个简单真实的需求讲起 2. mustache的用法 3. mustache的思想 4. {{prop}}标签 5. {{ ...