Comments (2)
您好,感谢提供的更优解,已将你的代码作为Update v2.0更新在了liuchuo.net、CSDN博客的PAT甲级1096题、GPLT的L1-006题的题解中并署名。提一点小建议:1 分析可以写的更详细,因为如果代码无问题,你写的分析我会直接复制在博客的题解中,不仅是为了我能够理解,还要为了方便看博客的人理解,所以可以写的更加详细,谢谢~2 分析不要总是那么多独立的句子和句号(句号之间至少应该是一个完整的语句吧),因为会显得很不温柔(很凶)的样子~ 3 记得代码一定要return 0;哦~
PS:你的代码风格很好 本仓库愿意长期接受你提供的更高效的代码
如有需要我会在仓库的readme.md文件中末尾加上这句话:感谢@littlesevenmo为PAT甲级多次提供的更效的解法
from pat.
思路分析:
1,如果只有一个因子,那么这个数只能为1或者质数。因此我们主要去计算两个及以上因数的情况。
2,在有两个及以上的数连乘中,因数的最大上限为sqrt(N),即N的平方根。
3,因此思路就是,不断构造连乘,看连乘的积是否是N的因数,如果是,则看这部分连乘的数的个数是否比已记录的多。
4,用变量first记录连乘的第一个数字,这里我把它赋初值为0,如果在寻找N的因数过程中,first没有改变,那么就表明N是1或者是一个质数。
----------卖萌的分割线--------------嘤
这次不凶了吧✿✿ヽ(°▽°)ノ✿
---------------------------------------嘤
谢谢提醒,我下次不会再忘return 0;啦
---------------------------------------嘤
如果可以上致谢名单,那太好啦,灰常感谢!
from pat.
Related Issues (20)
- 1018 不必模拟整个过程,need记录权重最小值即可
- [Advanced/C++/1135] Suggestion
- [Advanced/C++/1095] bug report
- [Advanced/C++/1159] Suggestion
- [Advanced/C++/1103]代码执行结果与样本输出结果不同,但是能够AC
- [Basic level Java] 1015 德才论
- [Basic level Java] 1017. A除以B (20) 全部运行超时
- PAT (Basic Level)1008 数组元素循环右移问题 更为简单做法
- 【改写原解法】PAT【甲级】1060 Are They Equal (25 分)
- 【甲级1014另解】1014 Waiting in Line
- PAT BasicLevel 1032
- Lanqiao
- 乙级1056 组合数的和(C++)更优解
- [Advence/c++/1026]测试样例改变,导致第一个测试点过不去
- 提供乙级1008 python版本的PythonIC风格代码
- Pat乙级1008 数组元素循环右移问题(简洁到极致的写法)
- PAT-B 1018. 锤子剪刀布 (20)(最简洁巧妙的写法)
- PAT甲级1025 学生id定义 HOT 1
- 【PAT Advanced Level 1026 Table Tennis】关于同一秒钟多个桌子空闲,分配多个客人的情况
- 1069答案只能得十分呀怎么办 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pat.