Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e2685ed

Browse files
committedMar 2, 2023
[Map] Sorting. 단어 정렬
1 parent f0d8559 commit e2685ed

File tree

5 files changed

+65
-3
lines changed

5 files changed

+65
-3
lines changed
 

‎2023/2023.vcxproj

+7-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,13 @@
139139
</Link>
140140
</ItemDefinitionGroup>
141141
<ItemGroup>
142-
<ClCompile Include="Virus.cpp" />
143-
<ClCompile Include="유기농배추.cpp" />
142+
<ClCompile Include="Virus.cpp">
143+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
144+
</ClCompile>
145+
<ClCompile Include="단어 정렬.cpp" />
146+
<ClCompile Include="유기농배추.cpp">
147+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
148+
</ClCompile>
144149
</ItemGroup>
145150
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
146151
<ImportGroup Label="ExtensionTargets">

‎2023/2023.vcxproj.filters

+6
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
1414
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
1515
</Filter>
16+
<Filter Include="소스 파일\Class2">
17+
<UniqueIdentifier>{c73290b2-f75a-4ef6-9cc0-38540cc043a1}</UniqueIdentifier>
18+
</Filter>
1619
</ItemGroup>
1720
<ItemGroup>
1821
<ClCompile Include="유기농배추.cpp">
@@ -21,5 +24,8 @@
2124
<ClCompile Include="Virus.cpp">
2225
<Filter>소스 파일</Filter>
2326
</ClCompile>
27+
<ClCompile Include="단어 정렬.cpp">
28+
<Filter>소스 파일\Class2</Filter>
29+
</ClCompile>
2430
</ItemGroup>
2531
</Project>

‎2023/단어 정렬.cpp

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <iostream>
2+
#include <vector>
3+
#include <algorithm>
4+
#include <queue>
5+
#include <map>
6+
using namespace std;
7+
8+
9+
bool cmp(const pair<string, int> a, const pair<string, int> b) {
10+
if (a.second == b.second) return a.first < b.first;
11+
return a.second < b.second;
12+
}
13+
14+
int main(void) {
15+
map <string, int> m;
16+
int N;
17+
string a;
18+
cin >> N;
19+
for (int i = 0; i < N; i++) {
20+
cin >> a;
21+
m.insert({ a, a.length() });
22+
}
23+
24+
vector <pair<string, int>> vec(m.begin(), m.end());
25+
sort(vec.begin(), vec.end(), cmp);
26+
for (auto iter = vec.begin(); iter != vec.end(); iter++) {
27+
cout << iter->first << '\n';
28+
}
29+
}

‎BOJ.sln

+20
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDS
2222
EndProject
2323
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Toss", "Toss\Toss.vcxproj", "{DD4BA924-28CE-4E09-8D71-120A7D976CD8}"
2424
EndProject
25+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2022_Winter", "2022_Winter\2022_Winter.vcxproj", "{16FAEEDB-D407-47AA-A13B-EB81872222B5}"
26+
EndProject
27+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "2023", "2023\2023.vcxproj", "{C1B93E37-BECC-4788-AFFB-EE169C6F6599}"
28+
EndProject
2529
Global
2630
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2731
Debug|x64 = Debug|x64
@@ -110,6 +114,22 @@ Global
110114
{DD4BA924-28CE-4E09-8D71-120A7D976CD8}.Release|x64.Build.0 = Release|x64
111115
{DD4BA924-28CE-4E09-8D71-120A7D976CD8}.Release|x86.ActiveCfg = Release|Win32
112116
{DD4BA924-28CE-4E09-8D71-120A7D976CD8}.Release|x86.Build.0 = Release|Win32
117+
{16FAEEDB-D407-47AA-A13B-EB81872222B5}.Debug|x64.ActiveCfg = Debug|x64
118+
{16FAEEDB-D407-47AA-A13B-EB81872222B5}.Debug|x64.Build.0 = Debug|x64
119+
{16FAEEDB-D407-47AA-A13B-EB81872222B5}.Debug|x86.ActiveCfg = Debug|Win32
120+
{16FAEEDB-D407-47AA-A13B-EB81872222B5}.Debug|x86.Build.0 = Debug|Win32
121+
{16FAEEDB-D407-47AA-A13B-EB81872222B5}.Release|x64.ActiveCfg = Release|x64
122+
{16FAEEDB-D407-47AA-A13B-EB81872222B5}.Release|x64.Build.0 = Release|x64
123+
{16FAEEDB-D407-47AA-A13B-EB81872222B5}.Release|x86.ActiveCfg = Release|Win32
124+
{16FAEEDB-D407-47AA-A13B-EB81872222B5}.Release|x86.Build.0 = Release|Win32
125+
{C1B93E37-BECC-4788-AFFB-EE169C6F6599}.Debug|x64.ActiveCfg = Debug|x64
126+
{C1B93E37-BECC-4788-AFFB-EE169C6F6599}.Debug|x64.Build.0 = Debug|x64
127+
{C1B93E37-BECC-4788-AFFB-EE169C6F6599}.Debug|x86.ActiveCfg = Debug|Win32
128+
{C1B93E37-BECC-4788-AFFB-EE169C6F6599}.Debug|x86.Build.0 = Debug|Win32
129+
{C1B93E37-BECC-4788-AFFB-EE169C6F6599}.Release|x64.ActiveCfg = Release|x64
130+
{C1B93E37-BECC-4788-AFFB-EE169C6F6599}.Release|x64.Build.0 = Release|x64
131+
{C1B93E37-BECC-4788-AFFB-EE169C6F6599}.Release|x86.ActiveCfg = Release|Win32
132+
{C1B93E37-BECC-4788-AFFB-EE169C6F6599}.Release|x86.Build.0 = Release|Win32
113133
EndGlobalSection
114134
GlobalSection(SolutionProperties) = preSolution
115135
HideSolutionNode = FALSE

‎BOJ/BOJ.vcxproj

+3-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@
158158
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
159159
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
160160
</ClCompile>
161-
<ClCompile Include="BOJ10886 (Java랑 시간 비교).cpp" />
161+
<ClCompile Include="BOJ10886 (Java랑 시간 비교).cpp">
162+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
163+
</ClCompile>
162164
<ClCompile Include="BOJ11050.cpp">
163165
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
164166
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>

0 commit comments

Comments
 (0)
Please sign in to comment.