-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/testhere |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Linux", | ||
"includePath": [ | ||
"${workspaceFolder}/**" | ||
], | ||
"defines": [], | ||
"cStandard": "c17", | ||
"cppStandard": "c++17", | ||
"intelliSenseMode": "linux-gcc-x64", | ||
"compilerPath": "/usr/bin/g++" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"files.associations": { | ||
"ostream": "cpp", | ||
"iostream": "cpp", | ||
"stdexcept": "cpp", | ||
"any": "cpp", | ||
"optional": "cpp", | ||
"variant": "cpp", | ||
"hash_map": "cpp", | ||
"*.tcc": "cpp", | ||
"deque": "cpp", | ||
"list": "cpp", | ||
"string": "cpp", | ||
"unordered_map": "cpp", | ||
"vector": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"version": "2.0.0", | ||
"runner": "terminal", | ||
"type": "shell", | ||
"echoCommand": true, | ||
"presentation": { | ||
"reveal": "always" | ||
}, | ||
"tasks": [ | ||
{ | ||
"label": "save and compile for C++", | ||
"command": "g++", | ||
"args": [ | ||
"${file}", | ||
"-o", | ||
"-g", | ||
"${fileDirname}/${fileBasenameNoExtension}" | ||
], | ||
"group": "build", | ||
"problemMatcher": { | ||
"fileLocation": [ | ||
"relative", | ||
"${workspaceRoot}" | ||
], | ||
"pattern": { | ||
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"severity": 4, | ||
"message": 5 | ||
} | ||
} | ||
}, | ||
{ | ||
"label": "save and compile for C", | ||
"command": "gcc", | ||
"args": [ | ||
"${file}", | ||
"-o", | ||
"-g", | ||
"${fileDirname}/${fileBasenameNoExtension}" | ||
], | ||
"group": "build", | ||
"problemMatcher": { | ||
"fileLocation": [ | ||
"relative", | ||
"${workspaceRoot}" | ||
], | ||
"pattern": { | ||
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning error):\\s+(.*)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"severity": 4, | ||
"message": 5 | ||
} | ||
} | ||
}, | ||
{ | ||
"label": "execute", | ||
"command": "cd ${fileDirname} &&./${fileBasenameNoExtension}", | ||
"group": "test" | ||
}, | ||
{ | ||
"type": "cppbuild", | ||
"label": "C/C++: g++ build active file", | ||
"command": "/usr/bin/g++", | ||
"args": [ | ||
"-fdiagnostics-color=always", | ||
"-g", | ||
"${file}", | ||
"-o", | ||
"${fileDirname}/${fileBasenameNoExtension}" | ||
], | ||
"options": { | ||
"cwd": "${fileDirname}" | ||
}, | ||
"problemMatcher": [ | ||
"$gcc" | ||
], | ||
"group": { | ||
"kind": "build", | ||
"isDefault": true | ||
}, | ||
"detail": "Task generated by Debugger." | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
|
||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
int t0 = 0; | ||
int t1 = 0; | ||
|
||
int arr0[41] = { | ||
1, | ||
0, | ||
}; | ||
int arr1[41] = { | ||
0, | ||
1, | ||
}; | ||
|
||
int arrf[41] = { | ||
0, | ||
}; | ||
|
||
int fibonacci(int n) { | ||
if (n == 0) { | ||
++t0; | ||
return 0; | ||
} else if (n == 1) { | ||
++t1; | ||
arrf[1] = 1; | ||
return 1; | ||
} else if (arrf[n] != 0) { | ||
t0 += arr0[n]; | ||
t1 += arr1[n]; | ||
return arrf[n]; | ||
} | ||
|
||
arrf[n] = fibonacci(n - 1) + fibonacci(n - 2); | ||
|
||
arr0[n] = t0; | ||
arr1[n] = t1; | ||
return arrf[n]; | ||
} | ||
|
||
int main() { | ||
int a, b; | ||
scanf("%d", &a); | ||
|
||
for (int i = 0; i < a; i++) { | ||
scanf("%d", &b); | ||
fibonacci(b); | ||
// printf("%d,", ); | ||
printf("%d %d\n", arr0[b], arr1[b]); | ||
t0 = 0; | ||
t1 = 0; | ||
} | ||
return 0; | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.