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 ...
随机推荐
- 根据样式获取被选中的checkbox
<ul id="> </div> </li></ul> $("#btn_CheckManagerCompletionCreateAt ...
- Android DrawerLayout 点击事情穿透
今天使用DrawerLayout做网易4.4版本侧边栏发现点击DrawerLayout空白部分,下面部分content会获得点击事件.解决方法是在<!-- The navigation draw ...
- PHP CI框架下,如果配置NGINX(根目录和子目录两种模式)
摸索了一会儿,先配置成功,再看看PATH_INFO之类的东东吧. A,根目录: location ~ \.php($|/) { root html; fastcgi_pass ; fastcgi_in ...
- win8、win8.1官方版本、及安装密钥
云盘地址:Windows 8 简体中文专业版+核心版 MSDN 正式版(32位)http://pan.baidu.com/s/1eQgiAiQSHA1:0C4A168E37E38EFB59E88443 ...
- C++ 中捕获整数除零错误
继承自 C 的优良传统, C++ 也是一门非常靠近底层的语言, 可是实在是太靠近了, 很多问题语言本身没有提供解决方案, 可执行代码贴近机器, 运行时没有虚拟机来反馈错误, 跑着跑着就毫无征兆地崩溃了 ...
- Hdu2425-Hiking Trip(优先队列搜索)
Hiking in the mountains is seldom an easy task for most people, as it is extremely easy to get lost ...
- QString转换为char*
QString在Qt里相当于C++里的std::string,或者是C里的c style string.不过,QString跟编码相关,在低层想把一个QString发送出去相当麻烦,尤其对方用的不是Q ...
- JavaScript 基础二
JavaScript 事件处理程序就是一组语句,在事件(如点击鼠标或移动鼠标等)发生时执行 ●当事件之间互相影响时,需要有个先后顺序,这时我们声明一个Bool值来做约束 浏览对象: window 对象 ...
- 集合操作出现的ConcurrentModificationException(源码分析)
摘要: 为了保证线程安全,在迭代器迭代的过程中,线程是不能对集合本身进行操作(修改,删除,增加)的,否则会抛出ConcurrentModificationException的异常. 示例: publi ...
- zXing使用小结
在android上二维码.条形码扫描,google官方为我们提供了zXing,几乎android涉及到扫描的都是用这个开源项目实现的,也有在android上使用zBar的,和其他用过的交流得知zBar ...