Skip to content

Commit

Permalink
레포 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
namaek2 committed Dec 16, 2023
1 parent b18e5fe commit 851b46f
Show file tree
Hide file tree
Showing 24 changed files with 179 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/testhere
16 changes: 16 additions & 0 deletions .vscode/c_cpp_properties.json
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
}
17 changes: 17 additions & 0 deletions .vscode/settings.json
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"
}
}
89 changes: 89 additions & 0 deletions .vscode/tasks.json
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."
}
]
}
56 changes: 56 additions & 0 deletions BOJ/BOJ 1003.cpp
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.

0 comments on commit 851b46f

Please sign in to comment.