博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
UVA 10791 最小公倍数的和
阅读量:4693 次
发布时间:2019-06-09

本文共 683 字,大约阅读时间需要 2 分钟。

这道题目细节琐碎,稍不注意就会WA ,特别是大数的范围,一开始没有把n声明为long long 导致最大的那个数 2147483647 结果为0 还有一开始用了 pow() 这个函数,也应该用double去接受结果。

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;int main(){ int cnt,t; long long n,sum,temp,m=0; while(cin>>n){ m++;sum=0,cnt=0; t=sqrt(n+1); if(n==0) break; printf("Case %d: ",m); if(n==1) {cout<<2<
1){ sum+=n; cnt++; } if(cnt==1) {printf("%lld\n",sum+1);} else if(cnt==0) printf("%lld\n",n+1); else printf("%lld\n",sum); } return 0;}

  

转载于:https://www.cnblogs.com/wintersong/p/5260810.html

你可能感兴趣的文章
Python学习教程:用Python做一个三阶拼图
查看>>
Codeforces 1203F2. Complete the Projects (hard version)
查看>>
创建.net framework webapi出现“Web 服务器被配置为不列出此目录的内容。”错误
查看>>
c#中关于@的作用
查看>>
Excel转换成xml文件
查看>>
关于Java链接c#的webapi的注意事项
查看>>
关于vs无法创建虚拟目录的问题
查看>>
ad域的那些事儿
查看>>
如何将自己写的程序加入到计算机服务里
查看>>
C# 二维码 ThoughtWorks.QRCode.dll
查看>>
git 提交顺序
查看>>
ios9怎么设置6位密码 ios9设置6位密码图文教程
查看>>
Python单元测试——深入理解unittest
查看>>
python BaseManager中register()的描述
查看>>
Windbg 脚本命令简介 一
查看>>
Java中跳出多层循环的简单方法
查看>>
类和对象:面向对象编程 - 零基础入门学习Python037
查看>>
寄存器AX
查看>>
C/C++UNION中包含STRUCT
查看>>
CocoStuff—基于Deeplab训练数据的标定工具【三、标注工具的使用】
查看>>