c++ - C++,不能处理大于 10^5 的数字的问题
问题描述
每当我尝试使用大于 10^6 的 R 时,控制台不会返回任何内容。我的目标是 L、R、n、br 的数量能够达到 10^18。谢谢帮助。
我的代码:
#include<iostream>
#include<cmath>
using namespace std;
int main() {
long long L, R, br=0;
double p,q,r;
cin>>p>>q>>r>>L>>R;
for (long long n=L; n<=R; n++) {
if (
ceil(n/p)+ceil(n/q)+ceil(n/r)<=n
){br++;}
}
cout<<br;
return 0;
}
解决方案
推荐阅读
- excel - 将公式从 Excel 复制到文本编辑器不可靠
- c++ - C++程序间歇性运行
- asp.net-mvc - 在 certmgr 中的哪里安装证书?
- javascript - React-js 中的 require() 函数不起作用
- php - 注册页面未向数据库发送数据并显示 0 个错误
- android - MaterialDatePicker RTL 月份分页按钮
- spring-boot - JHipster 微服务 CORS
- flask - SqlAlchemy/ALembic 迁移 - 如何忽略错误并应用迁移
- google-colaboratory - Google Colab - 谷歌驱动器的授权错误
- python - Pythonanywhere Textract UnicodeDecodeError ONLY on website