Problem J. Joke

题目连接:

http://codeforces.com/gym/100714

Description

The problem is to cut the largest possible number of circles with diameter y out of a stripe of length x

and width y.

Input

The only line of input consists of two positive real numbers x and y with 9-digit precision separated by

spaces. The integers may be written without decimal point.

Output

Output a single integer — the maximum number of circles one can cut out of the stripe.

Sample Input

6.3 0.9

Sample Output

7

Hint

题意

给你两个数,问你A/B是多少,保证小数点后9为小数以内。

题解:

乘以1e9,然后再除就好了

代码

import java.io.*;
import java.math.*;
import java.util.*; public class Main
{
public static void main(String argv[]) throws Exception
{
Scanner cin = new Scanner(System.in);
String x = cin.next() , y = cin.next();
{
int find = 0;
for(int i = 0 ; i < x.length() ; ++ i) if( x.charAt(i) =='.' ) find = 1;
if( find == 0 ) x += '.';
}
{
int find = 0;
for(int i = 0 ; i < y.length() ; ++ i) if( y.charAt(i) =='.' ) find = 1;
if( find == 0 ) y += '.';
}
int m1 = 0 , m2 = 0;
{
int find = 0;
for(int i = 0 ; i < x.length() ; ++ i){
if( x.charAt(i) == '.' ) find = 1;
else if( find == 1 ) ++ m1;
}
}
{
int find = 0;
for(int i = 0 ; i < y.length() ; ++ i){
if( y.charAt(i) == '.' ) find = 1;
else if( find == 1 ) ++ m2;
}
}
int ms = Math.max( m1 , m2 );
for(int i = m1 ; i < ms ; ++ i) x+='0';
for(int i = m2 ; i < ms ; ++ i) y+='0';
BigInteger A = BigInteger.ZERO , B = BigInteger.ZERO;
for(int i = 0 ; i < x.length() ; ++ i){
if( x.charAt(i) != '.' ){
int add = x.charAt(i) - '0';
A = A.multiply( BigInteger.valueOf(10) );
A = A.add( BigInteger.valueOf(add) );
}
}
for(int i = 0 ; i < y.length() ; ++ i){
if( y.charAt(i) != '.' ){
int add = y.charAt(i) - '0';
B = B.multiply( BigInteger.valueOf(10) );
B = B.add( BigInteger.valueOf(add) );
}
}
System.out.println( A.divide(B) );
}
}

2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem J. Joke 水题的更多相关文章

  1. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem H. Hometask 水题

    Problem H. Hometask 题目连接: http://codeforces.com/gym/100714 Description Kolya is still trying to pass ...

  2. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem F. Finance 模拟题

    Problem F. Finance 题目连接: http://codeforces.com/gym/100714 Description The Big Boss Company (BBC) pri ...

  3. ACM ICPC 2016–2017, NEERC, Northern Subregional Contest Problem J. Java2016

    题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:2s 空间限制:256MB 题目大意: 给定一个数字c 用 " ...

  4. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem D. Distance 迪杰斯特拉

    Problem D. Distance 题目连接: http://codeforces.com/gym/100714 Description In a large city a cellular ne ...

  5. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem C. Contest 水题

    Problem C. Contest 题目连接: http://codeforces.com/gym/100714 Description The second round of the annual ...

  6. 2016-2017 ACM-ICPC, NEERC, Moscow Subregional Contest Problem L. Lazy Coordinator

    题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229511 时间限制:1s 空间限制:512MB 题目大意: 给定一个n 随后跟着2n行输入 ...

  7. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem K. KMC Attacks 交互题 暴力

    Problem K. KMC Attacks 题目连接: http://codeforces.com/gym/100714 Description Warrant VI is a remote pla ...

  8. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem I. Interest Targeting 模拟题

    Problem I. Interest Targeting 题目连接: http://codeforces.com/gym/100714 Description A unique display ad ...

  9. 2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem A. Alien Visit 计算几何

    Problem A. Alien Visit 题目连接: http://codeforces.com/gym/100714 Description Witness: "First, I sa ...

随机推荐

  1. js 正则学习小记之匹配字符串字面量优化篇

    昨天在<js 正则学习小记之匹配字符串字面量>谈到 个字符,除了第一个 个,只有 个转义( 个字符),所以 次,只有 次成功.这 次匹配失败,需要回溯后用 [^"] 才能匹配成功 ...

  2. 工欲善其事必先利其器,用Emmet提高HTML编写速度

    HTML代码写起来很费事,因为它的标签多. 一种解决方法是采用模板,在别人写好的骨架内,填入自己的内容.还有一种很炫的方法----简写法. 常用的简写法,目前主要是Emmet和Haml两种.这两种简写 ...

  3. ASP.NET中最简单的自定义控件

    ASP.NET用户控件一般适用于产生相对静态的内容,所以没有builtin的事件支持.本文讨论用户控件返回事件的方法.          假定用户控件(UserControl.ascx)中包含按钮控件 ...

  4. plsql免安装客户端的配置

    不安装oracle,在安装了plsql之后,需要连接数据库,连接数据库需要在tns中tnsnames.ora中配置 首先需要两个文件: network instantclient-basic-win3 ...

  5. @PostConstruct和@PreConstruct

    详情参见:https://www.cnblogs.com/landiljy/p/5764515.html 1.@PostConstruct说明 被@PostConstruct修饰的方法会在服务器加载S ...

  6. docker stack 部署nginx

    =============================================== 2018/7/29_第1次修改                       ccb_warlock == ...

  7. Entity Framework 6.1.0 Tools for Visual Studio 2012 & 2013

    http://www.microsoft.com/en-us/download/confirmation.aspx?id=40762

  8. 【转】如何使用MAT分析内存泄漏

    原文链接:http://www.lightskystreet.com/2015/09/01/mat_usage/ MAT - Memory Analyzer Tool 使用进阶 Sep 1, 2015 ...

  9. Java基础86 MySQL数据库基础知识

    本文知识点(目录): 1.MySQL数据库的概述    2.MySQL数据库的管理[对数据库的操作](查询.删除.创建数据库,以及查询和修改数据库的编码模式)    3.表的管理[对数据库 表的操作] ...

  10. Centos7 服务器启动jar包

    首先Centos7 推荐我们这么运行项目 首先执行命令: cd /ets/systemd/system到这个目录下,新建一个 yourProjectName.service,可以把yourProjec ...