Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
616 changes: 616 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions fora22/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"files.associations": {
"*.rmd": "markdown",
"vector": "cpp"
}
}
26 changes: 26 additions & 0 deletions fora22/Source/Book_CodingTest_for_Employment/16/16_33/16_33.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
import sys
dirName = os.path.dirname(os.path.abspath(__file__))
sys.stdin = open(os.path.abspath(dirName + "/input.txt"), 'r')

N = int(sys.stdin.readline().rstrip())

dayTerm = 0 # 상담 기간 index
price = 1 # 상담료 index
schedule = [[-1, -1]]

for _ in range(N):
day, pay = map(int, sys.stdin.readline().rstrip().split())
schedule.append([day,pay])

dpTable = [0] * (15 + 5) # max N + max T
getMoney = 0
for i in range(1, N + 1):
getMoney = max(getMoney, dpTable[i])
next_idx = i + schedule[i][dayTerm]

dpTable[next_idx] = max(dpTable[next_idx], getMoney + schedule[i][price])

result = dpTable[:N+2]

print(max(result))
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;
vector<int> sliceArrayComposedInt(string sLine); // �Է¹��� ���ڿ��� vector�� ��ȯ���ִ� �Լ�
int getMaxValue(int a, int b); // �� ���� � ���� �� ū�� �����ִ� �Լ�
int getMaxElement(vector<int> inputArray); // vector���� �ִ��� �����ִ� �Լ�

int main(void) {
// ifstream readfile("input.txt");
cin.tie(NULL);
ios::sync_with_stdio(false);

int N = 0;
string getInfo;
vector<int> getData;
vector<vector<int>> schedule = { {-1, -1} };

const int dayTerm = 0; // ��� �Ⱓ index
const int price = 1; // ���� index

/*if (readfile.is_open()) {
}*/
// getline(readfile, getInfo);
// N = stoi(getInfo);
cin >> N;


for (int i = 0; i < N; i++) {
// getline(readfile, getInfo);
cin >> getInfo;
getData = sliceArrayComposedInt(getInfo);
schedule.push_back(getData);
}


vector<int> dpTable(15 + 5);
int getMoney = 0;
int next_idx = 0;

for (int i = 1; i < N + 1; i++) {
getMoney = getMaxValue(getMoney, dpTable[i]);
next_idx = i + schedule[i][dayTerm];
dpTable[next_idx] = getMaxValue(dpTable[next_idx], getMoney + schedule[i][price]);
}

vector<int>::iterator iter;
vector<int> result = vector<int>(dpTable.begin(), dpTable.begin() + (N + 2));

int allPay = getMaxElement(result);

cout << allPay << "\n";

return 0;
}


vector<int> sliceArrayComposedInt(string sLine) {
int previous = 0;
int current = 0;
vector<int> resultSliceString;

current = sLine.find(" ");
while (current != string::npos) {
string substring = sLine.substr(previous, current - previous);
resultSliceString.push_back(stoi(substring));
previous = current + 1;
current = sLine.find(" ", previous);
}
resultSliceString.push_back(stoi(sLine.substr(previous, current - previous)));
// slice end

return resultSliceString;
}

int getMaxValue(int a, int b) {
int maxValue = 0;
if (a >= b) {
maxValue = a;
}
else {
maxValue = b;
}

return maxValue;
}

int getMaxElement(vector<int> inputArray) {
int maxValue = *max_element(inputArray.begin(), inputArray.end());

return maxValue;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31702.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16_34", "16_34.vcxproj", "{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}.Debug|x64.ActiveCfg = Debug|x64
{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}.Debug|x64.Build.0 = Debug|x64
{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}.Debug|x86.ActiveCfg = Debug|Win32
{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}.Debug|x86.Build.0 = Debug|Win32
{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}.Release|x64.ActiveCfg = Release|x64
{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}.Release|x64.Build.0 = Release|x64
{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}.Release|x86.ActiveCfg = Release|Win32
{F24EC0E7-F40E-4D66-B9BF-DA32CC7DD9ED}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {15AC74A2-E7AE-4E79-8E2D-649F1421E040}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{f24ec0e7-f40e-4d66-b9bf-da32cc7dd9ed}</ProjectGuid>
<RootNamespace>My1634</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="16_34.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="소스 파일">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="헤더 파일">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="리소스 파일">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="16_34.cpp">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
7
3 10
5 20
1 10
1 20
2 15
4 40
2 200
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
7
3 10
5 20
1 10
1 20
2 15
4 40
2 200
18 changes: 18 additions & 0 deletions fora22/Source/Book_CodingTest_for_Employment/16/16_34/16_34.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import os
import sys
dirName = os.path.dirname(os.path.abspath(__file__))
sys.stdin = open(os.path.abspath(dirName + "/input.txt"), 'r')

N = int(sys.stdin.readline().rstrip())

power = list(map(int, sys.stdin.readline().rstrip().split()))

power.reverse()
length = [1 for _ in range(N)] # 길이 담는 array

for i in range(1, len(power)):
for j in range(i):
if power[i] > power[j]:
length[i] = max(length[i], length[j] + 1)

print(N - max(length))
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
7
15 11 4 8 5 2 4