Skip to content

Commit af3f6cd

Browse files
committed
implementation
1 parent 7ff1550 commit af3f6cd

File tree

6 files changed

+89
-1
lines changed

6 files changed

+89
-1
lines changed

Baeckjoon/C/11047.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ int main() {
77
scanf("%d %d", &n, &k);
88

99
int* values = (int*)malloc(sizeof(int) * n);
10-
for (int i = n - 1; i >= 0; i--) {
10+
for (i = n - 1; i >= 0; i--) {
1111
scanf("%d", &values[i]);
1212
}
1313

Study/implementation/C/02.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <stdio.h>
2+
#include <string.h>
3+
4+
int main() {
5+
int n, i, sum, count = 0;
6+
char hour[3], minute[3], second[3];
7+
8+
scanf("%d", &n);
9+
10+
sum = n * 3600 + 3599;
11+
12+
for (i = 0; i < sum + 1; i++) {
13+
sprintf(hour, "%d", i / 3600);
14+
sprintf(minute, "%d", i % 3600 / 60);
15+
sprintf(second, "%d", i % 60);
16+
if (
17+
strstr(hour, "3") != NULL ||
18+
strstr(minute, "3") != NULL ||
19+
strstr(second, "3") != NULL
20+
) {
21+
count += 1;
22+
}
23+
}
24+
25+
printf("%d", count);
26+
27+
return 0;
28+
}

Study/implementation/Python/01.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
x, y = 1, 1
2+
mode = ['L', 'R', 'U', 'D']
3+
move_x = [0, 0, -1, 1]
4+
move_y = [-1, 1, 0, 0]
5+
6+
n = int(input())
7+
plan = list(input().split())
8+
9+
for s in plan:
10+
i = mode.index(s)
11+
if s == mode[i]:
12+
_x = x + move_x[i]
13+
_y = y + move_y[i]
14+
if _x < 1 or _x > n or _y < 1 or _y > n:
15+
continue
16+
x, y = _x, _y
17+
18+
print(x, y)

Study/implementation/Python/02.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
n = int(input())
2+
sum = n * 3600 + 3599
3+
count = 0
4+
5+
for i in range(sum + 1):
6+
hour = str(i // 3600)
7+
minute = str(i % 3600 // 60)
8+
second = str(i % 60)
9+
if '3' in hour + minute + second:
10+
count += 1
11+
12+
print(count)

Study/implementation/Python/03.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
move_x = [-1, -2, -2, -1, 1, 2, 2, 1]
2+
move_y = [-2, -1, 1, 2, 2, 1, -1, -2]
3+
case = 0
4+
5+
scan = input()
6+
x, y = ord(scan[0]) - 96, int(scan[1])
7+
8+
for i in range(8):
9+
_x = x + move_x[i]
10+
_y = y + move_y[i]
11+
if _y > 0 and _y < 9 and _x > 0 and _x < 9:
12+
case += 1
13+
14+
print(case)

Study/implementation/Python/04.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
alphabet, number = [], []
2+
3+
scan = input()
4+
5+
for s in scan:
6+
if s.isalpha():
7+
alphabet.append(s)
8+
continue
9+
number.append(int(s))
10+
11+
for i in range(len(alphabet)):
12+
for j in range(len(alphabet) - 1):
13+
if ord(alphabet[j]) > ord(alphabet[j + 1]):
14+
alphabet[j], alphabet[j + 1] = alphabet[j + 1], alphabet[j]
15+
16+
print(''.join(alphabet) + str(sum(number)) if len(number) != 0 else '')

0 commit comments

Comments
 (0)