refparo / blog Goto Github PK
View Code? Open in Web Editor NEWMy blog
Home Page: https://paro.one
My blog
Home Page: https://paro.one
你的doc是不是写的太复杂了。。。
嘛总之这是在催更啦w
#include<iostream>
//Project Euler No.5
using namespace std;
int pf[21];//Prime factor
void prime(int ii) {
if(ii==1)return;
if(ii==2) {
pf[2]++;
return;
}
int i,j, fac=0;
j = 2;
i=ii;
for(int m=2; m<=i; m++) {
fac=0;
while(i!=m) {
if(i%m==0) {
fac++;
i/=m;
} else break;
}
if(pf[m]<fac)pf[m]=fac;
//if(i==m)pf[m]++;
}
fac++;
if(pf[i]<fac)pf[i]=fac;
return;
}
int main() {
for (int i = 1; i <= 20; i++) prime(i);
long long data = 1;
for (int i = 0; i < 20; i++)
while(pf[i]>0) {
pf[i]--;
data*=i;
}
cout << data;
return 0;
}
Hi pr. I've read your solution to TCOC003.
Honestly, this program's complexity is too high...wwww It's needless to argue that using struct. is a kind of waste wwwwwwww
Oh, the way u use the sort function is ugly..The comparing function needs independence! (XD) U may make it a individual func.
The loop u write is Eye-breakive233
I think the cpp code u write is based on func. idea......
In the other hand, scala ver. is much betterrrr wwwwwwww
Just some small contribution, thank everyone-
Why you are trying to solve a problem with three languages but not three algorithm?
The most program languages are the same!
Variables, Functions and Expressions are much the same.
If you going to learn Python or JavaScript and so on, how difficult will it be?
我干嘛要用英语
我在说什么
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.