#include<iostream>using namespace std;int main(){ unsigned a,c=0,k; while(cin>>a) { k=a; for(int b=2;b<=a;b++) { if(a%b==0) { c = c+b; a = a/b; b=1; } } if(k==1) { c=1; } cout<<c<<endl; c = 0 ; }}
#includeusing namespace std;int main(){ unsigned a,c=0,k; while(cin>>a) { k=a; for(int b=2;b<=a;b++) { if(a%b==0) { c = c+b; a = a/b; b=1; } } if(k==1) { c=1; } cout<<c<<endl; c = 0 ; }}
要用質數篩法