Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
algo
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
김시환
algo
Commits
6708e233
Commit
6708e233
authored
3 years ago
by
김시환
Browse files
Options
Downloads
Patches
Plain Diff
22.02.15
parent
9c28d6ad
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Greedy/1343.cpp
+67
-0
67 additions, 0 deletions
Greedy/1343.cpp
Greedy/14916.cpp
+27
-0
27 additions, 0 deletions
Greedy/14916.cpp
Greedy/2217.cpp
+32
-0
32 additions, 0 deletions
Greedy/2217.cpp
README.md
+3
-0
3 additions, 0 deletions
README.md
with
129 additions
and
0 deletions
Greedy/1343.cpp
0 → 100644
+
67
−
0
View file @
6708e233
#include
<iostream>
#include
<string>
using
namespace
std
;
int
main
()
{
string
A
=
"AAAA"
;
string
B
=
"BB"
;
string
input
,
output
=
""
;
cin
>>
input
;
int
s
=
0
;
int
flag
=
0
;
for
(
int
i
=
0
;
i
<
input
.
length
();
i
++
)
{
if
(
input
[
i
]
==
'X'
)
continue
;
int
len
=
i
-
s
;
if
(
len
%
2
==
1
)
{
flag
=
1
;
break
;
}
int
four
,
two
;
four
=
len
/
4
;
len
-=
four
*
4
;
two
=
len
/
2
;
for
(
int
i
=
0
;
i
<
four
;
i
++
)
output
+=
A
;
for
(
int
i
=
0
;
i
<
two
;
i
++
)
output
+=
B
;
output
+=
"."
;
s
=
i
+
1
;
}
int
len
=
input
.
length
()
-
s
;
if
(
len
%
2
==
1
)
{
flag
=
1
;
}
else
{
int
four
,
two
;
four
=
len
/
4
;
len
-=
four
*
4
;
two
=
len
/
2
;
for
(
int
i
=
0
;
i
<
four
;
i
++
)
output
+=
A
;
for
(
int
i
=
0
;
i
<
two
;
i
++
)
output
+=
B
;
}
if
(
flag
==
1
)
cout
<<
-
1
<<
endl
;
else
cout
<<
output
<<
endl
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Greedy/14916.cpp
0 → 100644
+
27
−
0
View file @
6708e233
#include
<iostream>
using
namespace
std
;
int
main
()
{
int
N
;
cin
>>
N
;
int
five
,
two
;
five
=
N
/
5
;
N
-=
five
*
5
;
if
(
N
%
2
==
0
)
two
=
N
/
2
;
else
{
five
--
;
N
+=
5
;
two
=
N
/
2
;
}
if
(
five
<
0
)
cout
<<
-
1
<<
endl
;
else
cout
<<
five
+
two
<<
endl
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Greedy/2217.cpp
0 → 100644
+
32
−
0
View file @
6708e233
#include
<iostream>
#include
<vector>
#include
<algorithm>
#include
<functional>
using
namespace
std
;
int
main
()
{
int
N
;
cin
>>
N
;
vector
<
int
>
v
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
int
a
;
cin
>>
a
;
v
.
push_back
(
a
);
}
sort
(
v
.
begin
(),
v
.
end
(),
greater
<>
());
int
Max
=
0
;
for
(
int
i
=
0
;
i
<
v
.
size
();
i
++
)
{
int
now
=
(
i
+
1
)
*
v
[
i
];
if
(
Max
<
now
)
Max
=
now
;
}
cout
<<
Max
<<
endl
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
README.md
+
3
−
0
View file @
6708e233
...
...
@@ -27,4 +27,7 @@
### 22.01.19
*
Tree 끝
### 22.02.15
*
Greedy 시작
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