R7-7 cm2inch

简介: R7-7 cm2inch

Given foot and inch, the meter is (foot+inch/12)×0.3048.


What sould be the feet and inches for an input centimetre?


PS:One foot is 12 inches.


Input Format:

One integer in terms of cm.


Output Format:

One integer for the feet and another integer for the inches.


Sample Input:

170


Sample Output:

5 6


题解: 这个可以看成一个实数,可以看成两部分组成,整数部分由英尺组成,小数部分由英寸组成,我们要的是整数,所以n/30.48直接取整,小数部分带入公式即可

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int foot = (int)(n / 30.48);
        int inch = (int)((n / 30.48 - foot) * 12);
        System.out.println(foot + " " + inch);
    }
}
目录
相关文章
|
6月前
|
Kubernetes 应用服务中间件 nginx
Label,RC,HPA
Label,RC,HPA
|
10月前
|
安全
PADS VX1.2安装
关于PADS的文章都是基于PADS VX1.2进行讲解的,所以这里提供PADS VX1.2的下载及安装。下载方法:在公众号回复“PADS下载”获取下载链接(百度网盘)。下面我们来讲一下安装过程,主要提一下需要注意的环节,其它的都是正常点击“同意”或者“下一步”即可。
643 0
|
10月前
|
Kubernetes 调度 Perl
k8s--label
k8s--label
对 matplotlib.cm.RdYlBu() 的理解
对 matplotlib.cm.RdYlBu() 的理解
对 matplotlib.cm.RdYlBu() 的理解
|
移动开发 小程序 Android开发
从 Alpha 到 Beta,这次是 New mPaaS
新官网 新视觉 新容器
1053 0
从 Alpha 到 Beta,这次是 New mPaaS
|
监控 关系型数据库 大数据