Measuring Lengths in Baden
Lengths are measures in Baden in inches and feet. To a length from centimeters it is enough to know that an inch equals three centimeters in Baden and one foot contains 12 inches.
You are given a length equal to n centimeters. Your task is to convert it to feet and inches so that the number of feet was maximum. The result should be an integer rounded to the closest value containing an integral number of inches.
Note that when you round up, 1 cm rounds up to 0 inches and 2 cm round up to 1 inch.
The only line contains an integer n (1 ≤ n ≤ 10000).
Print two non-negative space-separated integers a and b, where a is the numbers of feet and b is the number of inches.
Sample test(s)
| input |
| 42 |
| output |
| 1 2 |
| input |
| 5 |
| output |
| 0 2 |
题解:输入厘米 转换为英尺英寸 注意四舍五入,"得寸进尺"。
代码:
#include <stdio.h>
#include <stdlib.h> int main()
{
int n, a, b;
scanf("%d", &n);
a = n/;
b = (n-*a)/;
if(n-*a-*b == ) {
b++;
if(b==) {
a++;
b = ;
}
}
printf("%d %d", a, b);
return ;
}
Measuring Lengths in Baden的更多相关文章
- CF125A Measuring Lengths in Baden 题解
Content 在 Baden,一英寸等于 \(3\) 厘米,一英尺等于 \(12\) 英寸. 现在有一个 \(n\) 厘米的物体,求在 Baden,它是几英尺又几英寸. 数据范围:\(1\leqsl ...
- codeforces 125 A-E 补题
A Measuring Lengths in Baden 进制转换 水题 #include<bits/stdc++.h> using namespace std; int main() { ...
- Measuring Signal Similarities
http://cn.mathworks.com/help/signal/examples/measuring-signal-similarities.html Open This Example ...
- Measuring the amount of writes in InnoDB redo logs
Choosing a good InnoDB log file size is key to InnoDB write performance. This can be done by measuri ...
- [java bug记录] java.util.zip.ZipException: invalid code lengths set
1. 描述:将代码迁移到maven工程,其中用ZipInputStream读取/src/main/resources下的zip文件时报错:“java.util.zip.ZipException: in ...
- USACO Section 5.3 Milk Measuring (IDDFS+dp)
迭代加深搜索,从小到大枚举桶数的上限maxd:对每个maxd,枚举每个组合,判断是否能够倒出q:直到得到answer.判断的部分就用dp(完全背包). ------------------------ ...
- Measuring & Optimizing I/O Performance
By Ilya Grigorik on June 23, 2009 Measuring and optimizing IO performance is somewhat of a black art ...
- Measuring Text Difficulty Using Parse-Tree Frequency
https://nlp.lab.arizona.edu/sites/nlp.lab.arizona.edu/files/Kauchak-Leroy-Hogue-JASIST-2017.pdf In p ...
- AtCoder Regular Contest 102 D - All Your Paths are Different Lengths
D - All Your Paths are Different Lengths 思路: 二进制构造 首先找到最大的t,使得2^t <= l 然后我们就能构造一种方法使得正好存在 0 到 2^t ...
随机推荐
- Android原理View、ViewGroup
Android的UI界面都是由View和ViewGroup及其派生类组合而成的.其中,View是所有UI组件的基类,而ViewGroup是容纳这些组件的容器,其本身也是从View派生出来的.Andro ...
- List myList=new ArrayList()的理解
ArrayList不是继承List接口,是实现了List接口.你写成ArrayList arrayList = new ArrayList();这样不会有任何问题.和List list = new A ...
- 转载收藏之用 - 微信公众平台开发教程(五):使用Senparc.Weixin.MP SDK
Senparc.Weixin.MP SDK已经涵盖了微信5.0的所有公共API,以及2013年10月29日升级之后大部分实用的接口. 整个项目的源代码以及已经编译好的程序集可以在这个项目中获取到:ht ...
- YII CDbCriteria总结
$criteria = new CDbCriteria; //$criteria->alias = 't'; //查询该表 $criteria->addInCondition('id', ...
- POJ 2986 A Triangle and a Circle
题意:给定一个三角形,以及一个圆的圆心坐标和半径,求圆和三角形的相交面积. 思路: 用三角剖分,三角形上每个线段都变成这个线段与圆心的三角形,然后算出每个三角形与圆的相交面积,然后根据有向面积的正负累 ...
- oracle client server那点事
oracle网络配置三个配置文件 listener.ora.sqlnet.ora.tnsnames.ora ,都是放在$ORACLE_HOME\network\admin目录下. 1. sqlnet ...
- php将会话保存在数据库里
php默认把会话保存在临时文件中,保存在数据库中可以提高安全性,在共享主机服务器上,所有web站点都使用同一个临时目录,这意味着数十个程序都在同一位置进行文件读取的操作,我们很容易就编写一个脚本从这个 ...
- Spiral Matrix 解答
Question Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in ...
- <转载>C++命名空间
原文http://blog.csdn.net/liufei_learning/article/details/5391334 一. 为什么需要命名空间(问题提出) 命名空间是ANSIC++引入的可以由 ...
- proxy set 拦截
set方法用来拦截某个属性的赋值操作. 假定Person对象有一个age属性,该属性应该是一个不大于200的整数,那么可以使用Proxy保证age的属性值符合要求. let validator = { ...