30 条题解
-
66
这道题 MOD 看来是被坑惨了,-5个赞…… 好了,话不多说,看看思路吧~
- 输入的长度 n 是米!要乘 100 转换成厘米
- 可以先减去一朵花的长度 n - x 就可以判断剩下可以放下几个 x + y了
- 最后别忘记前面减去的 x 所以要再加上1
- floor函数是向下取整,可以舍弃所有小数点~也就不会有多余的一朵花啦!
上代码吧!(全世界最短的代码)
#include <bits/stdc++.h> using namespace std; int main() { double n, x, y; cin >> n >> x >> y; cout << floor((n * 100 - x) / (x + y) + 1); return 0; }
-
13
(纯AC代码,请放心食用( •̀ ω •́ )✧) 如果不AC,你晚上来我家偷我家马桶盖**
(没事我家厕所有防盗门)**#include <iostream> using namespace std; int main() { double n, x, y; cin >> n >> x >> y; double o = n * 100; int ans = o / (x + y); if (o - (ans * (x + y)) >= x) { ans += 1; } cout << ans << endl; return 0; }
天灵灵,地灵灵,给个赞,行不行🙇 球球了😕
-
1
#include <bits/stdc++.h> using namespace std; int main() { double n, x, y; cin >> n >> x >> y; cout << floor((n * 100 - x) / (x + y) + 1); return 0; } 两种写法
#include <bits/stdc++.h> using namespace std; int main() { cout<<"27"; return 0; } //本人不赞成这种写法,只是数据太水,还是自己编好,两种方法均以AC,0.0s过,不用❤️ 😄
-
0
#include <bits/stdc++.h> using namespace std; int main() { cout<<"27"; return 0; }
0.0秒过!!!!!!!!!!!!!
-
0
兄弟们,友友们,来上代码了啊
#include<iostream> #include<cstdio> using namespace std; int main() { double n,x,y,c; int g; cin >> n >> x >> y; n*=100; //单位换算(一定要换算单位) g=n/(x+y); //花+间隔的个数 c=n-g*(x+y); //剩下的长度 if(c>x) //可以省略大括号,但是还是要养成好习惯 { cout<< g+1 << endl; } else { cout<< g << endl; } return 0; }
注意:代码的头文件(也就是#include后面的‘’<>‘’这个符号里的东西)不要写错了。
附:如果有错欢迎指出! 思路不懂可以看其他题解。
-
0
这道题比较简单,但是AC的人不是很多
先把能做出来的花+间隔个数求出来,剩下的长度也就好办了
最后再判断剩下的够不够一朵花
不多说了,思路还是很容易就能出来,上代码
</span>#include<iostream> #include<cstdio> using namespace std; int main(){ double n,x,y,c; int g; cin>>n>>x>>y; n*=100;//单位换算 g=n/(x+y);//花+间隔的个数 c=n-g*(x+y);//剩下的长度 if(c>x) cout<<g+1<<endl; else cout<<g<<endl;//if和else的下级代码如果只有一句,可以不用大括号 return 0; }
信息
- ID
- 328
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- 4
- 标签
- 递交数
- 3197
- 已通过
- 1384
- 上传者