Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김지수
/
0329_khuprj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김지수
2019-03-29 11:53:57 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c397b69f1dcc4248b12eb4f01c48ff9d5e5c644b
c397b69f
0 parents
test
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
0 deletions
Picnic.cpp
Picnic.cpp
0 → 100644
View file @
c397b69
#include<iostream>
using
namespace
std
;
int
result
;
int
N
,
M
;
bool
areFriends
[
10
][
10
];
bool
havePair
[
10
];
void
counting
(
int
n
)
{
bool
finished
=
true
;
int
first
=
-
1
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
if
(
!
havePair
[
i
])
{
finished
=
false
;
first
=
i
;
break
;
}
}
if
(
finished
)
{
result
+=
1
;
return
;
}
for
(
int
j
=
first
+
1
;
j
<
N
;
j
++
)
{
if
(
!
havePair
[
first
]
&&
!
havePair
[
j
]
&&
areFriends
[
first
][
j
])
{
havePair
[
first
]
=
true
;
havePair
[
j
]
=
true
;
counting
(
n
+
1
);
havePair
[
first
]
=
false
;
havePair
[
j
]
=
false
;
}
}
return
;
}
int
main
()
{
int
test
;
cin
>>
test
;
for
(
int
t
=
1
;
t
<=
test
;
t
++
)
{
result
=
0
;
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
havePair
[
i
]
=
false
;
for
(
int
j
=
0
;
j
<
10
;
j
++
)
{
areFriends
[
i
][
j
]
=
false
;
}
}
cin
>>
N
>>
M
;
for
(
int
i
=
0
;
i
<
M
;
i
++
)
{
int
a
,
b
;
cin
>>
a
>>
b
;
areFriends
[
a
][
b
]
=
true
;
areFriends
[
b
][
a
]
=
true
;
}
counting
(
0
);
cout
<<
result
<<
endl
;
}
return
0
;
}
\ No newline at end of file
Please
register
or
login
to post a comment