当前位置:网站首页>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的情况。
边栏推荐
- Nuxt.js spa与ssr的区别
- EasyCVR使用RTMP推流时不显示界面如何解决?
- Cool photo album code, happy birthday to the object!
- NOI OJ 1.3 20:计算2的幂 C语言
- What is JSX in the JS tutorial? Why do we need it?
- 2021-05-12内部类
- 开发者,你对云计算可能有些误解
- How does thymeleaf get the value of the request parameter in the URL?
- NFTs、Web3和元宇宙对数字营销意味着什么?
- 太无奈!微软停售 AI 情绪识别等技术,直言:“法律跟不上 AI 的发展”
猜你喜欢
随机推荐
陆奇首次出手投资量子计算
2021-05-10方法重写多态注意事项
Build a security video monitoring platform using Huawei cloud ECS server
2021-04-12 the first implementation of linked list!!!
2021-04-16 recursion
High performance computing center Infiniband overview
J. Med. Chem. | Release: a new drug design model for deep learning based on target structure
[software and system security] heap overflow
Build a QQ robot to wake up your girlfriend
NOI OJ 1.3 16:计算线段长度 C语言
2021-04-12 链表第一次实现!!!
sql根据比较日期新建字段
Build the information and innovation industry ecology, and make mobile cloud based on the whole stack of independent innovation
2021-05-12内部类
Bugs encountered in Oracle
基于STM32设计的宠物投喂器
Lu Qi invests in quantum computing for the first time
thymeleaf如何取url中请求参数值?
135137138445 unable to remotely connect to the database due to disabling
5次登陆失败,限制登录实践
![[software and system security] heap overflow](/img/ca/1b98bcdf006f90cabf3e90e416f7f2.png)








