-
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
4 changed files
with
178 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,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; | ||
//} |
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,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; | ||
//} |
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,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; | ||
//} |
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,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; | ||
} |