herrDeng網內搜尋

自訂搜尋

Ads

2017年11月1日 星期三

EX6 C++請用long long計算費氏數列至 f(91)

35 則留言:

B10433072廖翊翔 提到...

#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
#include <omp.h>
using namespace std;

long long ff[100];
long long f(long long n)
{
if(ff[n] == 0)
{
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s << "see\n";
system("pause");
return 0;
}

B10433090蔡語鋐 提到...

#include <iostream>
#include <cstdlib>
#include <random>
#include<string>
#include<fstream>
using namespace std;
#include<omp.h>
long long ff[100];
long long f(long long n)
{
if (ff[n] == 0)
{
if (n < 2)ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s << "sec\n";
system("pause");
return 0;
}

b10433073何明宗 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(long long n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s << " sec\n";
system("Pause");
return 0;
}

b10433081巫明芬 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n)
{
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s << "sec\n";
system("Pause");
return 0;
}

B10433106簡瑋佑 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(long long n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s << "sec\n";
system("Pause");
return 0;
}

B10433094 簡筱芸 提到...

#include<iostream>
#include<cstdlib>
#include <fstream>
#include<string>

using namespace std;
#include<omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main() {
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s << "sec\n";
system("Pause");
return 0;
}

B10433065劉勝威 提到...

#include<iostream>
#include<cstdlib>
#include<fstream>
using namespace std;
#include<omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2)ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main() {
fstream fout("fout.txt", ios::out);
for (int n=0; n <= 91; n++) {
double s = omp_get_wtime(),t;
cout <<"f"<<n<<"="<< f(n) << endl;
cout << (t=omp_get_wtime() - s) <<"sec\n";
fout << "f" << n << "=" <<f(n)<< endl;
fout << t<< "sec\n";
}

system("PAUSE");
}

B10533011 江道逸 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

B10533007 魏辰熾 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

B10533009 張仲崴 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

B10533008 張士晟 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

B10533073黃叡哲 提到...

#include
#include
#include
#include
using namespace std;
#include


long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",
cout << (t = omp_get_wtime()) - s)
fout << "f(" << n << ")=" << f(n)
fout << t << " sec\n";
}
fout.close();
system("pause");
return 0;




}

B10533006 劉純賓 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

B10533018 陳郁傑 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

B10433099 駱婉婷 提到...

#include<iostream>
#include<cstdlib>
#include<fstream>
#include<string>
using namespace std;
#include<omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0)
{
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];

}

else return ff[n];
}
int main()
{

fstream fout("f_n.txt",ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(),t;
cout << "f("<<n <<")="<< f(n)<< ",";
cout <<(t= omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}

fout.close();
system("Pause");
return 0;

}

B10533072吳堉瑋 提到...

#include
#include
#include
#include
using namespace std;
#include


long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",
cout << (t = omp_get_wtime()) - s)
fout << "f(" << n << ")=" << f(n)
fout << t << " sec\n";
}
fout.close();
system("pause");
return 0;




}

B10533071徐琮淇 提到...

#include
#include
#include
#include
using namespace std;
#include


long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",
cout << (t = omp_get_wtime()) - s)
fout << "f(" << n << ")=" << f(n)
fout << t << " sec\n";
}
fout.close();
system("pause");
return 0;




}

B10533015陳建志 提到...

#include<iostream>
#include<cstdlib>
#include<fstream>
#include<string>
using namespace std;
#include<omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2)ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s <<"sec\n";
system("pause");
}

b10533017古峻衛 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

B10533062 洪尚郁 提到...

#include<iostream>
#include<cstdlib>
#include<fstream>
#include<string>

using namespace std;

#include<omp.h>
long long ff[100];
int f(int n) {
if (ff[n] == 0) {

if (n<2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];

}
int main() {
fstream fout("f_n.txt", ios::app);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << f(92) << endl;
cout << omp_get_wtime() - s << "sec\n";
fout << 'f(' << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("pause");
return 0;

}

B10533082 洪承楓 提到...

#include
#include
#include
#include
using namespace std;
#include


long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",
cout << (t = omp_get_wtime()) - s)
fout << "f(" << n << ")=" << f(n)
fout << t << " sec\n";
}
fout.close();
system("pause");
return 0;




}

b10533004 李登恩 提到...

#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>

using namespace std;

#include<omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main() {
fstream fout("f_n.txt", ios::app);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << f(91) << endl;
cout << omp_get_wtime() - s << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("pause");
return 0;
}

B10533075 提到...

#include
#include
#include
using namespace std;
int main()
{
cout << "hello\n";
fstream fout;
fout.open("hello.csv", ios::out);
fout << "hello\n";
fout.close();
system("Pause");
return 0;
}

B10533063陳廣制 提到...

#include
#include
#include
#include
using namespace std;
#include


long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",
cout << (t = omp_get_wtime()) - s)
fout << "f(" << n << ")=" << f(n)
fout << t << " sec\n";
}
fout.close();
system("pause");
return 0;




}

B10533085羅偉辰 提到...

#include
#include
#include
#include
using namespace std;
#include


long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",
cout << (t = omp_get_wtime()) - s)
fout << "f(" << n << ")=" << f(n)
fout << t << " sec\n";
}
fout.close();
system("pause");
return 0;




}

B10533093許永炎 提到...

#include
#include
#include
#include
using namespace std;
#include


long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",
cout << (t = omp_get_wtime()) - s)
fout << "f(" << n << ")=" << f(n)
fout << t << " sec\n";
}
fout.close();
system("pause");
return 0;




}

B10533010蕭凱維 提到...

#include
#include
#include
#include
using namespace std;
#include
long ff[100];
long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",";
cout << (t = omp_get_wtime() - s) << " sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << " sec\n";
}
fout.close();
system("Pause");
return 0;
}

B10433107袁婕寧 提到...

#include
#include
#include
#include
using namespace std;
#include
long long ff[100];
long long f(int n) {
if (ff[n] == 0)
{
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];

}

else return ff[n];
}
int main()
{

fstream fout("f_n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",";
cout << (t = omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}

fout.close();
system("Pause");
return 0;

}

B10533132許敏茹 提到...

#include
#include
#include
#include
using namespace std;
#include
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f__n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp__get__wtime(), t;
cout << (t = omp__get__wtime() - s) << "sec\n";
fout << t << "sec\n";
}
fout.close();
system("pause");
return 0;
}

B10533132許敏茹 提到...

#include <iostream>
#include<ctdlib>
#include<fstream>
#include<string>
using namespace std;
#include <omp.h>
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f__n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp__get__wtime(), t;
cout << (t = omp__get__wtime() - s) << "sec\n";
fout << t << "sec\n";
}
fout.close();
system("pause");
return 0;
}

b10333093 徐子軒 提到...

#include
#include
#include
#include
using namespace std;
#include
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];

}
else return ff[n];
}



int main()
{
fstream fout("f_n.txt", ios::out);
for (int n = 0; n <= 91; n++) {
double s = omp_get_wtime(), t;
cout << "f(" << n << ")=" << f(n) << ",";
cout << (t = omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}


fout.close();
system("Pause");
return 0;


}

B10433071雷昕翰 提到...

#include
#include
#include
#include
#include
using namespace std;

long long ff[100];
long long f(long long n)
{
if(ff[n] == 0)
{
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s << "see\n";
system("pause");
return 0;
}

B10533076 姜國傑 提到...

#include
#include
#include
#include
#include
using namespace std;

long long ff[100];
long long f(long long n)
{
if(ff[n] == 0)
{
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
double s = omp_get_wtime();
cout << f(91) << endl;
cout << omp_get_wtime() - s << "see\n";
system("pause");
return 0;
}

b10533075 陳詔瑋 提到...

#include
#include
#include
#include
using namespace std;
#include
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

b10533029 游淑娥 提到...

#include
#include
#include
#include
using namespace std;
#include
long long ff[100];
long long f(int n) {
if (ff[n] == 0) {
if (n < 2) ff[n] = 1;
else ff[n] = f(n - 2) + f(n - 1);
return ff[n];
}
else return ff[n];
}
int main()
{
fstream fout("f_n.txt", ios::out);
for(int n = 0;n <= 91; n++){
double s = omp_get_wtime(),t;
cout << "f("<<n<<")="<<f(n)<<",";
cout << (t=omp_get_wtime() - s) << "sec\n";
fout << "f(" << n << ")=" << f(n) << ",";
fout << t << "sec\n";
}
fout.close();
system("Pause");
return 0;
}

Related Posts Plugin for WordPress, Blogger...

熱門文章