Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- unsigned int n,d;
- double S;
- ifstream f("suminvdiv.in");
- ofstream g("suminvdiv.out");
- while(f>>n)
- {
- S=0;
- for(d=1;d*d<n;++d)
- if(n%d==0)
- S+=1.0/d+1.0/(n/d);
- if(d*d==n)
- S+=1.0/d;
- g<<fixed<<setprecision(2)<<S<<' ';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement