2010-2011 ACM-ICPC, NEERC, Moscow Subregional Contest Problem J. Joke 水题
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 水题的更多相关文章
- 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 ...
- 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 ...
- ACM ICPC 2016–2017, NEERC, Northern Subregional Contest Problem J. Java2016
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229510 时间限制:2s 空间限制:256MB 题目大意: 给定一个数字c 用 " ...
- 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 ...
- 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 ...
- 2016-2017 ACM-ICPC, NEERC, Moscow Subregional Contest Problem L. Lazy Coordinator
题目来源:http://codeforces.com/group/aUVPeyEnI2/contest/229511 时间限制:1s 空间限制:512MB 题目大意: 给定一个n 随后跟着2n行输入 ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- bzoj千题计划238:bzoj3668: [Noi2014]起床困难综合症
http://www.lydsy.com/JudgeOnline/problem.php?id=3668 这..一位一位的来就好了呀 #include<cstdio> #include&l ...
- hdu 5755 Gambler Bo (高斯消元法解同余方程组)
http://acm.hdu.edu.cn/showproblem.php?pid=5755 题意: n*m矩阵,每个格有数字0/1/2 每选择一个格子,这个格子+2,4方向相邻格子+1 如何选择格子 ...
- Linux之svn数据备份、还原及迁移
前言 因管理需求现要将svn数据进行备份,作为运维小哥的我在收到指令后进行了相关操作.当然,领导告知的是要备份,但作为一个有思想的运维,我考虑到的是自己要干的不仅仅是备份操作,还要确保在备份后数据还原 ...
- webstorm去掉vue错误提示
- elementUI下拉框错误记录
选择广东省深圳市,保存,再编辑是这样效果 原因 保存的那张表相关字段为字符串,而生成下拉框该字段是整数,两者改成一致即可 修改后
- 使用Sysmon和Splunk探测网络环境中横向渗透
当前很难在网络中探测攻击者横向渗透,其中原因有很难获取必要的日志和区别正常与恶意行为.本篇文章介绍通过部署Sysmon并将日志发送到SIEM来探测横向渗透. 工具: Sysmon + Splunk l ...
- Heapify
Given an integer array, heapify it into a min-heap array. For a heap array A, A[0] is the root of he ...
- 联通-长春处,FDD和TDD宏站,数据业务接入时延期望值默认值应为80ms
有小坑 备注:若已经跑过V5.40.00_Alpha1_Baseline.sql或V5.30.02_Beta_TO_V5.40.00_Alpha1.sql的脚本,再次运行升级脚本修改不成功,需手动在数 ...
- http和socket之长连接和短连接区别【转】
转自:https://blog.csdn.net/mengyafei43/article/details/25195445 TCP/IP TCP/IP是个协议组,可分为三个层次:网络层.传输层和应用层 ...
- Linux那些事儿之我是Hub(大结局)挂起自动化【转】
转自:http://blog.csdn.net/fudan_abc/article/details/1805471 目睹了当今大学校园的素质流氓化,kiss公开化,消费白领化,上课梦游化,逃课普遍化, ...