Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
test
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
3
Snippets
Groups
Projects
Show more breadcrumbs
^고맙습니다 _布德天下_ 감사합니다_^))//
test
Commits
1ab41efa
Commit
1ab41efa
authored
4 years ago
by
^고맙습니다 _布德天下_ 감사합니다_^))//
Browse files
Options
Downloads
Patches
Plain Diff
KLDP 163338 -- 사슴과 학 이야기
parent
eea858ef
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
사슴_학/사슴_학.c
+95
-0
95 additions, 0 deletions
사슴_학/사슴_학.c
사슴_학/사슴_학.py
+35
-0
35 additions, 0 deletions
사슴_학/사슴_학.py
with
130 additions
and
0 deletions
사슴_학/사슴_학.c
0 → 100644
+
95
−
0
View file @
1ab41efa
/* -*- coding: utf-8 -*- */
/* KLDP 163338 */
#include
<stdio.h>
#include
<stdlib.h>
/***
### 우분투 18.04 LTS 에서 실험했습니다 ###
(bionic)soyeomul@localhost:~/gitlab/test/사슴_학$ gcc 사슴_학.c
(bionic)soyeomul@localhost:~/gitlab/test/사슴_학$ ./a.out 0 > 0
(bionic)soyeomul@localhost:~/gitlab/test/사슴_학$ ./a.out 1 > 1
(bionic)soyeomul@localhost:~/gitlab/test/사슴_학$ grep -f 0 1
(12, 23)
(bionic)soyeomul@localhost:~/gitlab/test/사슴_학$
***/
int
SSM
[]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
\
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
\
20
,
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
,
29
,
\
30
,
31
,
32
,
33
,
34
,
35
,};
int
HAK
[]
=
{
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
\
10
,
11
,
12
,
13
,
14
,
15
,
16
,
17
,
18
,
19
,
\
20
,
21
,
22
,
23
,
24
,
25
,
26
,
27
,
28
,
29
,
\
30
,
31
,
32
,
33
,
34
,
35
,};
int
idxSSM
;
int
sizeSSM
=
sizeof
(
SSM
)
/
sizeof
(
int
);
int
idxHAK
;
int
sizeHAK
=
sizeof
(
HAK
)
/
sizeof
(
int
);
/* int sum_hap = SSM[idxSSM](int) + HAK[idxHAK](int); */
/* int sum_hapdari = 4 * SSM[idxSSM](int) + 2 * HAK[idxHAK](int); */
int
hap
(
idxSSM
,
idxHAK
)
{
for
(
idxSSM
=
0
;
idxSSM
<
sizeSSM
;
idxSSM
++
)
{
for
(
idxHAK
=
0
;
idxHAK
<
sizeHAK
;
idxHAK
++
)
{
if
(
SSM
[
idxSSM
]
+
HAK
[
idxHAK
]
==
35
)
{
printf
(
"(%d, %d)
\n
"
,
SSM
[
idxSSM
],
HAK
[
idxHAK
]);
}
}
}
return
0
;
}
int
hapdari
(
idxSSM
,
idxHAK
)
{
for
(
idxSSM
=
0
;
idxSSM
<
sizeSSM
;
idxSSM
++
)
{
for
(
idxHAK
=
0
;
idxHAK
<
sizeHAK
;
idxHAK
++
)
{
if
(
4
*
SSM
[
idxSSM
]
+
2
*
HAK
[
idxHAK
]
==
94
)
{
printf
(
"(%d, %d)
\n
"
,
SSM
[
idxSSM
],
HAK
[
idxHAK
]);
}
}
}
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
==
1
)
{
printf
(
"0 ===> 합, 1 ===> 합다리
\n
"
);
return
0
;
}
int
choice
=
atoi
(
argv
[
1
]);
if
(
choice
==
0
)
{
hap
(
idxSSM
,
idxHAK
);
return
0
;
}
else
if
(
choice
==
1
)
{
hapdari
(
idxSSM
,
idxHAK
);
return
0
;
}
else
{
printf
(
"0 ===> 합, 1 ===> 합다리
\n
"
);
return
0
;
}
return
0
;
}
/*
* 편집: GNU Emacs 26.3 (Ubuntu 18.04)
* 마지막 갱신: 2020년 5월 24일
*/
This diff is collapsed.
Click to expand it.
사슴_학/사슴_학.py
0 → 100755
+
35
−
0
View file @
1ab41efa
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# KLDP [163338]
a
=
list
(
range
(
36
))
# 사슴 초기화
b
=
list
(
range
(
36
))
# 학 초기화
def
hap
(
x
,
y
):
# 합
xx
=
[];
yy
=
[]
for
i
in
x
:
for
j
in
y
:
if
i
+
j
==
35
:
xx
.
append
(
i
)
yy
.
append
(
j
)
return
zip
(
xx
,
yy
)
def
hapdari
(
x
,
y
):
# 합다리
xx
=
[];
yy
=
[]
for
i
in
x
:
for
j
in
y
:
if
4
*
i
+
2
*
j
==
94
:
xx
.
append
(
i
)
yy
.
append
(
j
)
return
zip
(
xx
,
yy
)
합
=
list
(
hap
(
a
,
b
))
합다리
=
list
(
hapdari
(
a
,
b
))
print
(
set
(
합
)
&
set
(
합다리
),
"
앞에꺼 [사슴] 뒤에꺼 [학] 입니다
"
)
# 편집: GNU Emacs 26.3 (Ubuntu 18.04)
# 마지막 갱신: 2020년 5월 24일
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment