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 ...
随机推荐
- 序列!序列!- 零基础入门学习Python016
序列!序列! 让编程改变世界 Change the world by program 你可能发现了,小甲鱼把列表.元组和字符串放在一块儿来讲解是有道理的,我们发现Ta们之间有很多共同点: 1. 都可以 ...
- 剖析C语言中a=a+++++a的无聊问题
同僚们闲聊,突然就聊到了a+++++a的问题.这种纯属C语言 “二” 级的问题应该是从a+++a引申出来的吧.于是乎兄弟姐妹们开始讨论它的运算结果,以及改如何理解.更有人写出(a++)+(++a) a ...
- IQC IPQC FQC OQC QA QE SQE CQS QM 简介区别
IQC Incoming quality control 来料质量控制.是企业产品过程质量的第一关,在这个部门工作的同事最主要的是要注意文件和资料,即:图纸 样品承认书 样板 ***配件检验规范 ,还 ...
- inux关于readlink函数获取运行路径的小程序
inux关于readlink函数获取运行路径的小程序 相关函数: stat, lstat, symlink 表头文件: #include <unistd.h> 定义函数:int re ...
- nodejs学习笔记之安装、入门
由于项目需要,最近开始学习nodejs.在学习过程中,记录一些必要的操作和应该注意的点. 首先是如何安装nodejs环境?(我用的是windows 7环境,所以主要是windows 7的例 ...
- Nx32926 命令关机
一. poweroff关机命令 ~ # poweroff ~ # baud=, quot= w-config: 8bits/char umount: devtmpfs busy - remounted ...
- 设置Eclipse启动JDK
打开eclipse安装目录下的eclipse.ini文件,将红色内容加入 -vm ../Java/jdk1.6.0_26/bin (或者指向具体目录:D:/software/jdk_1.8u91/bi ...
- [转]Laravel 4之数据库操作
Laravel 4之数据库操作 http://dingjiannan.com/2013/laravel-database/ 数据库配置 Laravel数据库配置在app/config/database ...
- vue 单页面应用实战
1. 为什么要 SPA? SPA: 就是俗称的单页应用(Single Page Web Application). 在移动端,特别是 hybrid 方式的H5应用中,性能问题一直是痛点. 使用 SPA ...
- EffectiveC#5--始终提供ToString()
1.System.Object版的ToString()方法只返回类型的名字 2.知道要重写它,返回更有意义的信息,最好是提供几个重载版本. 3.当你设计更多的复杂的类型时(格式化文本)应该实现应变能力 ...