這是Herr Deng桑的教學blog,主要處理作業與班導事務,另外還有數位小品。
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main() { cout<<"pi\n"; cout<<"Input n="; unsigned n; cin>>n; double sum=0; for(int i=1;i<=n;i++){ sum=sum+1/((double)i*i) ; } cout<<"ans>>"<<sqrt(6*sum)<<endl; system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ cout << "pi......\n"; cout << "Input n="; unsigned n; double sum=0; cin >>n; cout << n<<endl; for(int i=1;i<=n;i++) { sum=sum+1/((double)i*i); } cout <<sqrt(6*sum); system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main() { cout << "Compute pi......\n"; cout << "Input n="; unsigned n; double sum=0; cin >> n; cout << n << endl; for (int i=1;i<=n;i++) { sum = sum+1/((double)i*i); } cout << sqrt(6*sum); system("Pause"); return 0;}
#include<iostream>#include<cstdlib>#include<cmath>using namespace std;int main(){ cout << "Compute pi.....\n"; cout << "Input n="; unsigned n; double sum = 0; cin >> n; cout << n << endl; for (int i = 1; i <= n; i++) { sum = sum + 1 / ((double)i*i); } cout << sqrt(6 * sum); system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ cout << "Compute pi...\n"; cout << "Input n="; double sum = 0; unsigned n; cin >> n; cout << n << endl; for (int i=1;i<=n;i++) { sum = sum + 1 / ((double)i*i); } cout << sqrt(6*sum); system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main() { unsigned n; cin >> n; cout << n<<endl; double sum=0; for (int i = 1; i <= n; i++) { sum +=1/((double)i*i); } cout << sqrt(6*sum); system("Pause"); return 0;}
#include<iostream>#include<cstdlib>#include<cmath>using namespace std;int main(){ unsigned n; cout << "Compute pi.......\n"; cout << "Input n="; double sum = 0; cin >> n; cout << n << endl; for (int i = 1; i <= n; i++) { sum = sum + 1 / ((double)i*i); } cout << sqrt(6 * sum); system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main() { cout << "Compute pi....\n"; cout << "Input n="; unsigned n; cin >> n; double sum = 0; for (int i = 1; i <= n; i++) { sum = sum + 1 / double(i*i); } cout << sqrt(6 * sum); system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ cout << "Compute pi.....\n"; cout << "Input n="; double sum = 0; unsigned n; cin >> n; cout << n << endl; for (int i = 1; i <= n; i++) { sum = sum + 1 / ((double)i*i); } cout << sqrt(6 * sum); system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ cout << "Compute pi.......\n"; cout << "Input n="; unsigned n; double sum = 0; cin >> n; cout << n << endl; for (int i = 1; i <= n; i++) { sum = sum + 1 / ((double)i*i); } cout << sqrt(6 * sum); system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ cout << "Compute pi.....\n"; cout << "Input n="; unsigned n; double sum = 0; cin >> n; cout << n << endl; for (int i = 1; i <= n; i++) { sum = sum + 1 / ((double)i*i); } cout << sqrt(6 * sum); system("pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>#include <iomanip>#include <ctime>using namespace std;int main(){ cout << "Compute pi.....\n"; cout << "Input n="; unsigned n; double sum = 0; cin >> n; cout << n << endl; unsigned begin = clock(), end; for (int i = 1; i <= n; i++) { sum = sum + 1 / ((double)i*i); } cout << setprecision(16) << "zeta(2)=" << sum << endl; cout << "π=" << sqrt(6 * sum) << endl; end = clock(); cout << (end - begin) / 1000.0 << "sec\n"; system("pause"); return 0;}
#include <iostream>#include<cstdlib>#include<cmath>#include<iomanip>#include<ctime>using namespace std;int main(){ cout << "Compute pi .....\n"; cout << "Input n="; unsigned n; cin >> n; cout << n << endl; unsigned begin = clock(), end; double sum = 0; for (int i=1;i<=n;i++) { sum = sum + 1 / ((double)i*i); } cout << setprecision(16) << "zeta(2)=" << sum << endl; cout << sqrt(6 * sum)<<endl; end = clock(); cout << (end - begin) / 1000.0 << "sec \n"; system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ cout << "pi......\n"; cout << "Input n="; unsigned n; double sum = 0; cin >> n; cout << n << endl; for (int i = 1; i <= n; i++) { sum = sum + 1 / ((double)i*i); } cout << sqrt(6 * sum); system("pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>#include <iomanip>#include <ctime>using namespace std;int main(){ cout << "Compute pi.....\n"; cout << "Input n="; unsigned n; cin >> n; cout << n << endl; unsigned begin = clock(), end; double sum = 0; for (int i = 1; i <= n; i++) { sum = sum + 1 / ((double)i*i); } cout << setprecision(16) << "zata(2)=" << sum << endl; cout <<sqrt(6*sum) << endl; end = clock(); cout << (end - begin) / 1000.0 << "sec\n"; system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ cout << "Compute pi.....\n"; cout << "Iput n="; unsigned n; double sum = 0; cin >> n; cout << n << endl; for (int i = 1; i<=n; i++) { sum = sum + 1 / ((double)i*i); } cout << sqrt(6 * sum); system("Pause"); return 0;
#include #include #include #include #include using namespace std;int main(){ cout << "input n="; unsigned n; cin >> n; cout << n << endl; unsigned begin = clock(), end; double sum = 0; for (int i=1; i<=n;i++) { sum += 1.0 / ((double)i*i); } cout << setprecision(16) << "zeta(2)=" << sum << endl; cout << "%=" << sqrt(6 * sum) << endl; end = clock(); cout << (end - begin) / 1000.0 << "sec/n"; system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>#include <iomanip>#include <ctime>using namespace std;int main(){ cout<< "pi........\n"; cout<< "Input n="; unsigned n; double sum=0; cin>>n; cout<<n<<endl; unsigned begin=clock(),end; for(int i=1;i<=n;i++) { sum=sum+1.0/((double)i*i); } cout <<sqrt(6*sum); system("pause"); return 0;}
#include<iostream>#include<cstdlib>#include<cmath>#include<iomanip>#include<ctime>using namespace std;int main(){ cout << "Compute Pi......\n "; cout << "Input n="; cin >> n; unsigned n; double sum = 0; for (int i = 1; i <= n; i++) sum += 1.0 / ((double)i*i); cout << setprecision(16) << "zeta(2)" << sum << endl; cout << Pi << sum << endl; end = clock(); cout << (end - begin / 1000.0 <<"sec\n") system("Pause"); return 0; }
#include <iostream>#include <cstdlib>#include <cmath>#include <iomanip>using namespace std;int main(){ cout << "Compute pi.....\n"; cout << "Input n="; unsigned n; cin >> n; cout << n << endl; unsigned begin =clock(), end; double sum = 0; for (int i = 1; i <= n; i++) { sum += + 1.0 / ((double)i*i); } cout << setprecision(16) << "zera(2)=" << sum << endl; cout << "π="<< sqrt(6 * sum)<<endl; end = clock(); cout << (end - begin) / 1000.0 << " sec\n"; system("Pause"); return 0;}
#include #include #include using namespace std;int main(){ cout << "compute pi.....\n"; cout << "Input n="; unsigned n; double sum = 0; cin >> n; cout << n << endl; for (int i = 1; i < n; i++) { sum = sum + 1.0 / ((double)i*i); } cout << sqrt(6*sum); system("pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>using namespace std;int main(){ cout << "Compute pi.....\n"; cout << "Input n="; unsigned n; cin >> n; cout << n << endl; double sum = 0; for (int i = 1; i <= n; i++) { sum += 1 / ((double)i*i); } cout << sqrt(6 * sum); sfas system("Pause"); return 0;}
#include <iostream>#include <cstdlib>#include <cmath>#include <iomanip>#include <ctime>using namespace std;int main(){ cout << "Input n="; unsigned n; cin >> n; cout << n << endl; unsigned begin = clock(), end; double sum=0; for (int i = 1; i <= n ; i++) sum += 1.0 / ((double)i*i); cout << setprecision(16) << "zeta(2)=" << sum << endl; cout << "π=" << sqrt(6 * sum) << endl; end = clock(); cout << (end - begin) / 1000.0 << "sec\n"; system("Pause"); return 0;}
#include #include #include #include #include using namespace std;#include int main(){ cout << "input n="; unsigned n; cin >> n; cout << n << endl; unsigned begin = clock(), end; double sum = 0;#pragma omp parallel for reduction(+ : sum) for (int i=1; i<=n;i++) { sum += 1.0 / ((double)i*i); } cout << setprecision(16) << "zeta(2)=" << sum << endl; cout << "%=" << sqrt(6 * sum) << endl; end = clock(); cout << (end - begin) / 1000.0 << "sec/n"; system("Pause"); return 0;}
#include #include #include using namespace std;int main() {cout<<"pi\n";cout<<"Input n=";unsigned n;cin>>n;double sum=0;for(int i=1;i<=n;i++){sum=sum+1/((double)i*i) ;}cout<<"ans>>"<<sqrt(6*sum)<<endl;system("Pause");return 0;}
#include #include #include #include #include using namespace std;#include int main(){cout << "input n=";unsigned n; cin >> n;cout << n << endl;unsigned begin = clock(), end;double sum = 0;#pragma omp parallel for reduction(+ : sum)for (int i=1; i<=n;i++){sum += 1.0 / ((double)i*i);}cout << setprecision(16) << "zeta(2)=" << sum << endl;cout << "%=" << sqrt(6 * sum) << endl;end = clock();cout << (end - begin) / 1000.0 << "sec/n";system("Pause");return 0;}
張貼留言
33 則留言:
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main() {
cout<<"pi\n";
cout<<"Input n=";
unsigned n;
cin>>n;
double sum=0;
for(int i=1;i<=n;i++){
sum=sum+1/((double)i*i) ;
}
cout<<"ans>>"<<sqrt(6*sum)<<endl;
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "pi......\n";
cout << "Input n=";
unsigned n;
double sum=0;
cin >>n;
cout << n<<endl;
for(int i=1;i<=n;i++)
{
sum=sum+1/((double)i*i);
}
cout <<sqrt(6*sum);
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "Compute pi......\n";
cout << "Input n=";
unsigned n;
double sum=0;
cin >> n;
cout << n << endl;
for (int i=1;i<=n;i++)
{
sum = sum+1/((double)i*i);
}
cout << sqrt(6*sum);
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
int main()
{
cout << "Compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6 * sum);
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "Compute pi...\n";
cout << "Input n=";
double sum = 0;
unsigned n;
cin >> n;
cout << n << endl;
for (int i=1;i<=n;i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6*sum);
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main() {
unsigned n;
cin >> n;
cout << n<<endl;
double sum=0;
for (int i = 1; i <= n; i++)
{
sum +=1/((double)i*i);
}
cout << sqrt(6*sum);
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
int main()
{
unsigned n;
cout << "Compute pi.......\n";
cout << "Input n=";
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6 * sum);
system("Pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
int main()
{
unsigned n;
cout << "Compute pi.......\n";
cout << "Input n=";
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6 * sum);
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main() {
cout << "Compute pi....\n";
cout << "Input n=";
unsigned n;
cin >> n;
double sum = 0;
for (int i = 1; i <= n; i++) {
sum = sum + 1 / double(i*i);
}
cout << sqrt(6 * sum);
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "Compute pi.....\n";
cout << "Input n=";
double sum = 0;
unsigned n;
cin >> n;
cout << n << endl;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6 * sum);
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "Compute pi.......\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6 * sum);
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "Compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6 * sum);
system("pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <ctime>
using namespace std;
int main()
{
cout << "Compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
unsigned begin = clock(), end;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << setprecision(16) << "zeta(2)=" << sum << endl;
cout << "π=" << sqrt(6 * sum) << endl;
end = clock();
cout << (end - begin) / 1000.0 << "sec\n";
system("pause");
return 0;
}
#include <iostream>
#include<cstdlib>
#include<cmath>
#include<iomanip>
#include<ctime>
using namespace std;
int main(){
cout << "Compute pi .....\n";
cout << "Input n=";
unsigned n;
cin >> n;
cout << n << endl;
unsigned begin = clock(), end;
double sum = 0;
for (int i=1;i<=n;i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << setprecision(16) << "zeta(2)=" << sum << endl;
cout << sqrt(6 * sum)<<endl;
end = clock();
cout << (end - begin) / 1000.0 << "sec \n";
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "pi......\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6 * sum);
system("pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <ctime>
using namespace std;
int main()
{
cout << "Compute pi.....\n";
cout << "Input n=";
unsigned n;
cin >> n;
cout << n << endl;
unsigned begin = clock(), end;
double sum = 0;
for (int i = 1; i <= n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << setprecision(16) << "zata(2)=" << sum << endl;
cout <<sqrt(6*sum) << endl;
end = clock();
cout << (end - begin) / 1000.0 << "sec\n";
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "Compute pi.....\n";
cout << "Iput n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i<=n; i++)
{
sum = sum + 1 / ((double)i*i);
}
cout << sqrt(6 * sum);
system("Pause");
return 0;
#include
#include
#include
#include
#include
using namespace std;
int main()
{
cout << "input n=";
unsigned n; cin >> n;
cout << n << endl;
unsigned begin = clock(), end;
double sum = 0;
for (int i=1; i<=n;i++)
{
sum += 1.0 / ((double)i*i);
}
cout << setprecision(16) << "zeta(2)=" << sum << endl;
cout << "%=" << sqrt(6 * sum) << endl;
end = clock();
cout << (end - begin) / 1000.0 << "sec/n";
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <ctime>
using namespace std;
int main()
{
cout<< "pi........\n";
cout<< "Input n=";
unsigned n;
double sum=0;
cin>>n;
cout<<n<<endl;
unsigned begin=clock(),end;
for(int i=1;i<=n;i++)
{
sum=sum+1.0/((double)i*i);
}
cout <<sqrt(6*sum);
system("pause");
return 0;
}
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<iomanip>
#include<ctime>
using namespace std;
int main()
{
cout << "Compute Pi......\n ";
cout << "Input n=";
cin >> n;
unsigned n;
double sum = 0;
for (int i = 1; i <= n; i++)
sum += 1.0 / ((double)i*i);
cout << setprecision(16) << "zeta(2)" << sum << endl;
cout << Pi << sum << endl;
end = clock();
cout << (end - begin / 1000.0 <<"sec\n")
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
cout << "Compute pi.....\n";
cout << "Input n=";
unsigned n;
cin >> n;
cout << n << endl;
unsigned begin =clock(), end;
double sum = 0;
for (int i = 1; i <= n; i++)
{
sum += + 1.0 / ((double)i*i);
}
cout << setprecision(16) << "zera(2)=" << sum << endl;
cout << "π="<< sqrt(6 * sum)<<endl;
end = clock();
cout << (end - begin) / 1000.0 << " sec\n";
system("Pause");
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
cout << "compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i < n; i++)
{
sum = sum + 1.0 / ((double)i*i);
}
cout << sqrt(6*sum);
system("pause");
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
cout << "compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i < n; i++)
{
sum = sum + 1.0 / ((double)i*i);
}
cout << sqrt(6*sum);
system("pause");
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
cout << "compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i < n; i++)
{
sum = sum + 1.0 / ((double)i*i);
}
cout << sqrt(6*sum);
system("pause");
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
cout << "compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i < n; i++)
{
sum = sum + 1.0 / ((double)i*i);
}
cout << sqrt(6*sum);
system("pause");
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
cout << "compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i < n; i++)
{
sum = sum + 1.0 / ((double)i*i);
}
cout << sqrt(6*sum);
system("pause");
return 0;
}
#include
#include
#include
using namespace std;
int main()
{
cout << "compute pi.....\n";
cout << "Input n=";
unsigned n;
double sum = 0;
cin >> n;
cout << n << endl;
for (int i = 1; i < n; i++)
{
sum = sum + 1.0 / ((double)i*i);
}
cout << sqrt(6*sum);
system("pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int main()
{
cout << "Compute pi.....\n";
cout << "Input n=";
unsigned n;
cin >> n;
cout << n << endl;
double sum = 0;
for (int i = 1; i <= n; i++) {
sum += 1 / ((double)i*i);
}
cout << sqrt(6 * sum); sfas
system("Pause");
return 0;
}
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <ctime>
using namespace std;
int main()
{
cout << "Input n=";
unsigned n;
cin >> n;
cout << n << endl;
unsigned begin = clock(), end;
double sum=0;
for (int i = 1; i <= n ; i++)
sum += 1.0 / ((double)i*i);
cout << setprecision(16) << "zeta(2)=" << sum << endl;
cout << "π=" << sqrt(6 * sum) << endl;
end = clock();
cout << (end - begin) / 1000.0 << "sec\n";
system("Pause");
return 0;
}
#include
#include
#include
#include
#include
using namespace std;
#include
int main()
{
cout << "input n=";
unsigned n; cin >> n;
cout << n << endl;
unsigned begin = clock(), end;
double sum = 0;
#pragma omp parallel for reduction(+ : sum)
for (int i=1; i<=n;i++)
{
sum += 1.0 / ((double)i*i);
}
cout << setprecision(16) << "zeta(2)=" << sum << endl;
cout << "%=" << sqrt(6 * sum) << endl;
end = clock();
cout << (end - begin) / 1000.0 << "sec/n";
system("Pause");
return 0;
}
#include
#include
#include
using namespace std;
int main() {
cout<<"pi\n";
cout<<"Input n=";
unsigned n;
cin>>n;
double sum=0;
for(int i=1;i<=n;i++){
sum=sum+1/((double)i*i) ;
}
cout<<"ans>>"<<sqrt(6*sum)<<endl;
system("Pause");
return 0;
}
#include
#include
#include
using namespace std;
int main() {
cout<<"pi\n";
cout<<"Input n=";
unsigned n;
cin>>n;
double sum=0;
for(int i=1;i<=n;i++){
sum=sum+1/((double)i*i) ;
}
cout<<"ans>>"<<sqrt(6*sum)<<endl;
system("Pause");
return 0;
}
#include
#include
#include
#include
#include
using namespace std;
#include
int main()
{
cout << "input n=";
unsigned n; cin >> n;
cout << n << endl;
unsigned begin = clock(), end;
double sum = 0;
#pragma omp parallel for reduction(+ : sum)
for (int i=1; i<=n;i++)
{
sum += 1.0 / ((double)i*i);
}
cout << setprecision(16) << "zeta(2)=" << sum << endl;
cout << "%=" << sqrt(6 * sum) << endl;
end = clock();
cout << (end - begin) / 1000.0 << "sec/n";
system("Pause");
return 0;
}
張貼留言