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. BZOJ4103 异或运算

    4103: [Thu Summer Camp 2015]异或运算 Time Limit: 20 Sec  Memory Limit: 512 MB Description 给定长度为n的数列X={x1 ...

  2. vue双向绑定原理分析

    当我们学习angular或者vue的时候,其双向绑定为我们开发带来了诸多便捷,今天我们就来分析一下vue双向绑定的原理. 简易vue源码地址:https://github.com/jiangzhenf ...

  3. mysql基本操作【重要】

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAuYAAAVeCAIAAACyxWmSAAAgAElEQVR4nOydT0wbV/vvZzm7YXd2zI ...

  4. 5 THINGS TOP BUG BOUNTY HUNTERS DO DIFFERENTLY

    出处:https://www.hackerone.com/blog/5-things-top-bug-bounty-hunters-do-differently 本周,我们有幸收容了50名比利时科技学 ...

  5. 002_docker构建zookeeper环境

    最近因为要维护公司zk环境,所以自己先得搞一套先玩玩 git地址=>https://github.com/jplock/docker-zookeeper/tree/v3.4.9 一.build ...

  6. centos7.2环境yum方式快速搭建lnmp环境nginx+mariadb+php-fpm

    centos7.2环境yum方式安装nginx+mariadb+php-fpm 1.安装lnmp环境 安装epel源 yum install -y epel-release 安装 MySQL + PH ...

  7. asp.net防SQL/JS注入攻击:过滤标记

    /// <summary>/// 过滤标记/// </summary>/// <param name="NoHTML">包括HTML,脚本,数据 ...

  8. Ext.util.Format.date 时间格式的设置与转换

    Ext.util.Format.date 如下这段简单的代码:  var d = new Date(value.time); var s = Ext.util.Format.date(d, 'Y-m- ...

  9. (四)Dubbo Admin管理控制台

    Dubbo Admin管理控制台 在dubbo2.6.0往后的版本在dubbo发布包中就没有dubbo-admin了,而是在incubator-dubbo-ops(https://github.com ...

  10. 3种高效的Tags标签系统数据库设计方案分享

    需求背景 目前主流的博客系统.CMS都会有一个TAG标签系统,不仅可以让内容链接的结构化增强,而且可以让文章根据Tag来区分.相比传统老式的Keyword模式,这种Tag模式可以单独的设计一个Map的 ...