Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
KENEW authored Jan 5, 2021
1 parent 6e31720 commit 187e8b4
Showing 4 changed files with 178 additions and 0 deletions.
56 changes: 56 additions & 0 deletions 1002_터렛.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
//#include<iostream>
//using namespace std;
//
//typedef struct
//{
// int x;
// int y;
// int r;
//}Circle;
//
//Circle c1, c2;
//int N;
//
//int main(void)
//{
// cin >> N;
//
// for (int i = 0; i < N; i++)
// {
// cin >> c1.x >> c1.y >> c1.r;
// cin >> c2.x >> c2.y >> c2.r;
//
// int dis = (c1.x - c2.x) * (c1.x - c2.x) + (c1.y - c2.y) * (c1.y - c2.y);
//
// int con1 = (c1.r - c2.r) * (c1.r - c2.r);
// int con2 = (c1.r + c2.r) * (c1.r + c2.r);
//
// if (dis == 0)
// {
// if (con1 == 0)
// {
// cout << "-1" << '\n';
// }
// else
// {
// cout << "0" << '\n';
// }
// }
// else if (dis == con1 || dis == con2)
// {
// cout << "1" << '\n';
// }
// else if (con1 < dis && dis < con2)
// {
// cout << "2" << '\n';
// }
// else
// {
// cout << "0" << '\n';
// }
//
// }
//
//
// return 0;
//}
53 changes: 53 additions & 0 deletions 1003_피보나치_함수.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//#include<stdio.h>
//int arr[41];
//int N;
//
//int fibonachi(int num)
//{
// if (num == 0)
// {
// arr[0] = 0;
// return 0;
// }
// else if (num == 1)
// {
// arr[1] = 1;
// return 1;
// }
//
// if (arr[num] != 0)
// {
// return arr[num];
// }
// else
// {
// return arr[num] = fibonachi(num - 1) + fibonachi(num - 2);
// }
//}
//
//int main(void)
//{
// scanf("%d", &N);
//
// for (int i = 0; i < N; i++)
// {
// int inputNum;
// scanf("%d", &inputNum);
//
// if (inputNum == 0)
// {
// printf("%d %d\n", 1, 0);
// }
// else if (inputNum == 1)
// {
// printf("%d %d\n", 0 ,1);
// }
// else
// {
// fibonachi(inputNum);
// printf("%d %d\n", arr[inputNum - 1], arr[inputNum]);
// }
// }
//
// return 0;
//}
20 changes: 20 additions & 0 deletions 3053_택시_기하학.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//#include<cstdio>
//#define _USE_MATH_DEFINES
//#include<math.h>
//#include<iostream>
//using namespace std;
//
//int main(void)
//{
// double r, s1, s2;
//
// scanf("%lf", &r);
//
// s1 = (r * r) * M_PI;
// s2 = (r * r) * 2;
//
// printf("%.6f\n", s1);
// printf("%.6f\n", s2);
//
// return 0;
//}
49 changes: 49 additions & 0 deletions 9184_신나는_함수_실행.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include<iostream>
using namespace std;

int arr[21][21][21];

int solution(int a, int b, int c)
{
if (a <= 0 || b <= 0 || c <= 0)
{
return 1;
}
if (a > 20 || b > 20 || c > 20)
{
return solution(20, 20, 20);
}

if (arr[a][b][c] != 0)
{
return arr[a][b][c];
}

if (a < b && b < c)
{
return arr[a][b][c] = solution(a, b, c - 1) + solution(a, b - 1, c - 1) - solution(a, b - 1, c);
}
else
{
return arr[a][b][c] = solution(a - 1, b, c) + solution(a - 1, b - 1, c) + solution(a - 1, b, c - 1) - solution(a - 1, b - 1, c - 1);
}
}

int main(void)
{
int num1, num2, num3;

while (1)
{
cin >> num1 >> num2 >> num3;

if (num1 == -1 && num2 == -1 && num3 == -1)
{
break;
}

cout << "w(" << num1 << ", " << num2 << ", " << num3 << ") = " << solution(num1, num2, num3) << endl;
}

return 0;
}

0 comments on commit 187e8b4

Please sign in to comment.