计算概论(A)/基础编程练习1(8题)/2:苹果和虫子
#include<stdio.h>
#include<math.h>
int main() {
/* n个苹果 每x小时能吃掉一个苹果 经过y小时 */
float n, x, y; /* 输入数据保证 y <= n * x */
scanf("%f %f %f", &n, &x, &y); /* 输出剩余苹果数量 */
//printf("%d\n",(int)ceil(y/x));
printf("%d\n",(int)(n-ceil(y/x)));
return ;
}
/*
pkuic_6170.c
计算概论(A)/基础编程练习1(8题)/2:苹果和虫子
http://pkuic.openjudge.cn/base1/2/
2:苹果和虫子
查看
提交
统计
提问
总时间限制:
1000ms
内存限制:
65536kB
描述
你买了一箱n个苹果,很不幸的是买完时箱子里混进了一条虫子。虫子每x小时能吃掉一个苹果,假设虫子在吃完一个苹果之前不会吃另一个,那么经过y小时你还有多少个完整的苹果?
输入
输入仅一行,包括n,x和y(均为整数)。输入数据保证y <= n * x。
输出
输出也仅一行,剩下的苹果个数
样例输入
10 4 9
样例输出
7
提示
注意:是要求完整的苹果数。
*/
计算概论(A)/基础编程练习1(8题)/2:苹果和虫子的更多相关文章
- 计算概论(A)/基础编程练习2(8题)/8:1的个数
#include<stdio.h> int main() { ; // 存储测试数据的二进制形式中1的个数 int bian[N]; // 输入十进制整数N 表示N行测试数据 scanf( ...
- 计算概论(A)/基础编程练习2(8题)/7:整数的个数
#include<stdio.h> int main() { ] = {}; // 输入k个正整数 scanf("%d",&k); // 循环读入和进行算术 w ...
- 计算概论(A)/基础编程练习2(8题)/6:数组逆序重放
#include<stdio.h> int main() { // 输入n个整数 ; scanf("%d", &n); // 循环读入元素 while(scan ...
- 计算概论(A)/基础编程练习2(8题)/5:点和正方形的关系
#include<stdio.h> #include<math.h> int main() { // 输入坐标 float x, y; while(scanf("%f ...
- 计算概论(A)/基础编程练习1(8题)/1:大象喝水
#include<stdio.h> int main() { ; // n < 100 scanf("%d", &n); // 循环遍历判断 再进行平方和 ...
- 计算概论(A)/基础编程练习2(8题)/4:骑车与走路
#include<stdio.h> int main() { // 待处理的数据数量n ; scanf("%d", &n); float meters[n]; ...
- 计算概论(A)/基础编程练习2(8题)/3:计算三角形面积
#include<stdio.h> #include<math.h> int main() { // 声明三角形的三个顶点坐标和面积 float x1, y1, x2, y2, ...
- 计算概论(A)/基础编程练习2(8题)/2:计算书费
#include<stdio.h> int main() { // 声明与初始化 ; // k组测试数据的总费用 double s[k]; // 单价表 double price[]= { ...
- 计算概论(A)/基础编程练习2(8题)/1:求平均年龄
#include<stdio.h> int main() { // 声明与初始化 , s=, age=; // 输入学生人数 scanf("%d", &n); ...
随机推荐
- bootbox.js官方文档中文版
bootbox.js官方文档中文版简介:Bootbox.js是一个小型的JavaScript库,基于Bootstrap模态框开发,用于创建可编程的对话框. 不像原生的alert等对话框,所有的Boot ...
- python线程中的join(转)
Python多线程与多进程中join()方法的效果是相同的. 下面仅以多线程为例: 首先需要明确几个概念: 知识点一:当一个进程启动之后,会默认产生一个主线程,因为线程是程序执行流的最小单元,当设置多 ...
- [py]初始化dict结构和json.dump使用
1.json.dump使用 http://python3-cookbook.readthedocs.io/zh_CN/latest/c06/p02_read-write_json_data.html ...
- iot平台在k8s搭建过程
统一在 cd /opt/iot nohup /opt/iopservices.sh >/var/log/helmapi.log & 直接查看pod日志? kubectl logs i ...
- windows端口占用情况
https://jingyan.baidu.com/article/3c48dd34491d47e10be358b8.html netstat -ano,列出所有端口的情况. netstat -aon ...
- [LeetCode] 414. Third Maximum Number_Easy
Given a non-empty array of integers, return the third maximum number in this array. If it does not e ...
- centos下如何清除重复的$PATH变量值
运行: vim /etc/profile 添加如下代码: awk -F: '{ sep = "" for (i = 1; i <= NF; ++i) ...
- Python解决乱码问题
解决python乱码问题 字符串在python的内部采用unicode的编码方式,因此,在做编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode ...
- Rest概念学习
参考文章 http://www.cnblogs.com/shanyou/archive/2012/05/12/2496959.html http://www.cnblogs.com/loveis715 ...
- django 静态css js文件配置
参考:http://blog.csdn.net/liqiancao/article/details/66151287