当前位置:网站首页>NOI OJ 1.3 15:苹果和虫子 C语言
NOI OJ 1.3 15:苹果和虫子 C语言
2022-06-23 10:12:00 【chd44】
描述
你买了一箱n个苹果,很不幸的是买完时箱子里混进了一条虫子。虫子每x小时能吃掉一个苹果,假设虫子在吃完一个苹果之前不会吃另一个,那么经过y小时你还有多少个完整的苹果?
输入
输入仅一行,包括n,x和y(均为整数)。输入数据保证y <= n * x。
输出
输出也仅一行,剩下的苹果个数
此题思路也要将求余的思想带入进去,明确什么时候该再-1。
#include<stdio.h>
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int d=a-c/b;
int e=c%b;
if(e==0)
printf("%d",d);
else
printf("%d",d-1);
return 0;
}注:题目有限制,不用考虑计算结果会是<0的情况。
边栏推荐
- 文件IO(1)
- XML related interview questions
- NiO example
- Is there anyone who plans to open source an industrial "seckill" system architecture?
- mysql中innodb下的redo log什么时候开始执行check point落盘的?
- Multithreaded exercises
- 【第23天】给定一个长度为 n 的数组,将元素 X 插入数组指定的位置 | 数组插入操作4
- NOI OJ 1.4 03:奇偶数判断 C语言
- 2021-05-07构造器
- 2021-04-16 method overload parameter transfer
猜你喜欢

2021-05-07构造器

Confessing with Snake games (with source code)

CVPR大会现场纪念孙剑博士,最佳学生论文授予同济阿里,李飞飞获黄煦涛纪念奖...

Comic | code review is driving me crazy!

Data structures and differences between MySQL InnoDB engine and MyISAM

陆奇首次出手投资量子计算

Set up a QQ robot for ordering songs, and watch beautiful women

Successful experience of postgraduate entrance examination in materials and Chemical Engineering (metal) of Beijing University of Aeronautics and Astronautics in 2023

Three implementation methods of distributed lock

2021-05-07 constructor
随机推荐
【软件与系统安全】堆溢出
2021-05-12接口的定义与实现
beanstalk 常用方法、说明
NOI OJ 1.4 03:奇偶数判断 C语言
NOI OJ 1.3 13:反向输出一个三位数 C语言
文件IO(1)
2021-04-27类和对象
[day 23] given an array of length N, insert element x into the position specified by the array | array insertion operation 4
135137138445 unable to remotely connect to the database due to disabling
实现领域驱动设计 - 使用ABP框架 - 通用准则
R和RStudio下载安装详细步骤
Build a security video monitoring platform using Huawei cloud ECS server
Dr. Sun Jian was commemorated at the CVPR conference. The best student thesis was awarded to Tongji Ali. Lifeifei won the huangxutao Memorial Award
开发者,你对云计算可能有些误解
漫画 | Code Review快把我逼疯了!
The second Tencent light · public welfare innovation challenge was launched, and the three competition topics focused on the social value of sustainable development
2021-04-16数组
Distributed common interview questions
NOI OJ 1.3 14:大象喝水 C语言
Golang 快速上手 (1)