编写题解 2772: 苹果和虫子 解题思路:向上取整注意事项:头文件#include不要忘记,可以直接用ceil()函数实现向上取整。由于y和x都是整数,相除时得到的结果也是整型,那么向上取整就无法实现。要想实现向上取整,必须要让两个数相除后的结果是浮点型的, 题解列表 2025年11月08日 1 点赞 0 评论 593 浏览 评分:10.0
C语言 使用while循环解决问题 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main ( ){ int n=0 ,x=0 ;&nbs…… 题解列表 2025年01月02日 1 点赞 0 评论 599 浏览 评分:10.0
剩下的苹果的角度 解题思路:对于剩下的苹果,一是剩下都是完整的苹果,那么虫子吃的苹果为y/x;二是剩下的苹果中有一个是虫子没吃完的苹果,那么虫子吃的苹果为y/x+1,困为x/y会取整数,加上1,1是虫子没吃完的那个苹果.注意事项:参考代码:#includeintmain(){intn, 题解列表 2024年12月13日 2 点赞 0 评论 758 浏览 评分:10.0
2772:苹果与虫子 摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){ int n,x,y; scanf("%d%d%d",&n,&x,&y); if(y%x==0) prin…… 题解列表 2022年12月07日 0 点赞 0 评论 1242 浏览 评分:9.9
编写题解 2772: 苹果和虫子 摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){ int x,y,n; cin>>n>>x>>y; if(y…… 题解列表 2024年11月24日 2 点赞 0 评论 580 浏览 评分:9.9
苹果和虫子 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n,b,a,x; scanf("%d %d %d",&n,&b,&a); x=n-(a…… 题解列表 2024年11月07日 0 点赞 0 评论 583 浏览 评分:9.9
新手必看,苹果和虫子 摘要:解题思路:注意事项:参考代码:#include<stdio.h> int main(){ int n,x,y; scanf("%d %d %d",&n,&x,&y); int e=y/x; i…… 题解列表 2024年11月01日 0 点赞 0 评论 565 浏览 评分:9.9
我从不知何为败北,因为我家GeiGei无所畏惧,西内! 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n,x,y; scanf("%d%d%d", &n, &x, &y); float a…… 题解列表 2023年06月01日 0 点赞 0 评论 710 浏览 评分:9.9
苹果和虫子C语言 摘要:解题思路:注意事项:参考代码:#include <stdio.h>int main(){ int n,x,y; int d; float c; scanf("%d %d %d",&n,&…… 题解列表 2022年11月05日 0 点赞 0 评论 1093 浏览 评分:8.0
比较简单理解的方法 摘要:解题思路:注意事项:参考代码:#include<stdio.h>int main(){ int n,x,y; scanf("%d %d %d",&n,&x,&y); if(y<=x*n){ n = n…… 题解列表 2023年09月22日 0 点赞 0 评论 818 浏览 评分:7.3