题解 2772: 苹果和虫子

来看看其他人写的题解吧!要先自己动手做才会有提高哦! 
返回题目 | 我来写题解

筛选

C++简单解法

摘要:解题思路:此题属于简单题,主要需要知道向上取整的函数ceil(),其他的基本都是基础知识注意事项:参考代码:#include<iostream>#include<cmath>#……

剩下的苹果的角度

摘要:解题思路:对于剩下的苹果,一是剩下都是完整的苹果,那么虫子吃的苹果为y/x;二是剩下的苹果中有一个是虫子没吃完的苹果,那么虫子吃的苹果为y/x+1,困为x/y会取整数,加上1,1是虫子没吃完的那个苹果……

简单易懂哦

摘要:注意事项:使用了cmath数学常用库参考代码:#include<iostream>#include<cmath>using namespace std;int main(){ float n, x, ……

用java进行的尝试

摘要:解题思路:注意事项:参考代码:import java.util.Scanner;public class Main{ public static void main(String[] args){ S……

编写题解 2772: 苹果和虫子

摘要:解题思路:无注意事项:无参考代码:#include <bits/stdc++.h>using namespace std;int main(){    double n,x,y;    cin>>n>……

用ceil函数即可

摘要:解题思路:ceil函数可实现向上求整,此题思路为向下求整,故减一即可。注意事项:参考代码:  #include<iostream>  using namespace std;  #include<cm……

题解 2772: 苹果和虫子

摘要:解题思路:注意事项:参考代码:#include<iostream>using namespace std;int main(){    int x,y,n;    cin>>n>>x>>y;    i……

2772: 苹果和虫子

摘要:解题思路:注意事项:参考代码:#include <bits/stdc++.h>using namespace std;int main(){    double n,x,y;    cin>>n>>x……

题解 2772: 苹果和虫子

摘要:解题思路:注意事项:参考代码:#include<iostream>#include<cmath>using namespace std;int main(){float n, x, y, s;cin ……