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
Binary file added C/AlgorithmEx/.vs/AlgorithmEx/v16/.suo
Binary file not shown.
Binary file added C/AlgorithmEx/.vs/AlgorithmEx/v16/Browse.VC.db
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 31 additions & 0 deletions C/AlgorithmEx/AlgorithmEx.sln
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.31424.327
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AlgorithmEx", "AlgorithmEx\AlgorithmEx.vcxproj", "{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}"
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
{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}.Debug|x64.ActiveCfg = Debug|x64
{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}.Debug|x64.Build.0 = Debug|x64
{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}.Debug|x86.ActiveCfg = Debug|Win32
{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}.Debug|x86.Build.0 = Debug|Win32
{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}.Release|x64.ActiveCfg = Release|x64
{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}.Release|x64.Build.0 = Release|x64
{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}.Release|x86.ActiveCfg = Release|Win32
{C9325BD6-EDA1-4281-AACC-DD8CF239C57A}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {02437D95-912D-4F9B-AEEB-EF960E30C4A0}
EndGlobalSection
EndGlobal
77 changes: 77 additions & 0 deletions C/AlgorithmEx/AlgorithmEx/AlgorithmEx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#include <stdio.h>
int n;
int WB[2] = { 0, }; // 0 : white, 1: blue
char Paper[129][129] = { 0, }; // idx: 1 ~ 128

int check(int ltr, int ltc, int rbr, int rbc) {
// return 1 : need to divide
int cnt[2] = { 0, }; // 0 : white, 1: blue
for (int i = ltr; i <= rbr; i++) {
for (int j = ltc; j <= rbc; j++) {
cnt[Paper[i][j] - '0']++;
if (cnt[0] > 0 && cnt[1] > 0)
return 1; // different color
}
}

// same color
if (cnt[0] > 0)
WB[0]++;
else
WB[1]++;

return 0;
}

// left-top-row, left-top-col, right-botton-row, right-botton-col
void divide(int ltr, int ltc, int rbr, int rbc) {
int offset = (rbr - ltr + 1) / 2;
if (offset == 1) {
for (int i = ltr; i <= rbr; i++) {
for (int j = ltc; j <= rbc; j++) {
WB[Paper[i][j] - '0']++;
}
}
}
else {
if (check(ltr, ltc, ltr + offset - 1, ltc + offset - 1))
divide(ltr, ltc, ltr + offset - 1, ltc + offset - 1);

if (check(ltr, ltc + offset, ltr + offset - 1, rbc))
divide(ltr, ltc + offset, ltr + offset - 1, rbc);

if (check(ltr + offset, ltc, rbr, ltc + offset - 1))
divide(ltr + offset, ltc, rbr, ltc + offset - 1);

if (check(ltr + offset, ltc + offset, rbr, rbc))
divide(ltr + offset, ltc + offset, rbr, rbc);
}
}

int main(void) {
int cnt[2] = { 0, }; // 0 : white, 1: blue
char trash;

scanf("%d", &n);
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
scanf(" %c", &Paper[i][j]);
cnt[Paper[i][j] - '0']++;
}
}


if (cnt[0] > 0 && cnt[1] > 0) {
divide(1, 1, n, n);
printf("%d\n%d\n", WB[0], WB[1]);
}
else {
if (cnt[0] > 0)
WB[0] = 1;
else
WB[1] = 1;
printf("%d\n%d\n", WB[0], WB[1]);
}

return 0;
}
147 changes: 147 additions & 0 deletions C/AlgorithmEx/AlgorithmEx/AlgorithmEx.vcxproj
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>{c9325bd6-eda1-4281-aacc-dd8cf239c57a}</ProjectGuid>
<RootNamespace>AlgorithmEx</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); _CRT_SECURE_NO_WARNINGS; </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="p1074.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
22 changes: 22 additions & 0 deletions C/AlgorithmEx/AlgorithmEx/AlgorithmEx.vcxproj.filters
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="p1074.c">
<Filter>소스 파일</Filter>
</ClCompile>
</ItemGroup>
</Project>
11 changes: 11 additions & 0 deletions C/AlgorithmEx/AlgorithmEx/Debug/AlgorithmEx.exe.recipe
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ProjectOutputs>
<ProjectOutput>
<FullPath>C:\Users\nohsa\source\repos\AlgorithmEx\Debug\AlgorithmEx.exe</FullPath>
</ProjectOutput>
</ProjectOutputs>
<ContentFiles />
<SatelliteDlls />
<NonRecipeFileRefs />
</Project>
Binary file added C/AlgorithmEx/AlgorithmEx/Debug/AlgorithmEx.ilk
Binary file not shown.
2 changes: 2 additions & 0 deletions C/AlgorithmEx/AlgorithmEx/Debug/AlgorithmEx.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
 p1074.c
AlgorithmEx.vcxproj -> C:\Users\nohsa\source\repos\AlgorithmEx\Debug\AlgorithmEx.exe
Binary file added C/AlgorithmEx/AlgorithmEx/Debug/AlgorithmEx.obj
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PlatformToolSet=v142:VCToolArchitecture=Native32Bit:VCToolsVersion=14.29.30037:VCServicingVersionATL=14.29.30038:VCServicingVersionCrtHeaders=14.29.30038:VCServicingVersionCompilers=14.29.30038:TargetPlatformVersion=10.0.19041.0:
Debug|Win32|C:\Users\nohsa\source\repos\AlgorithmEx\|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added C/AlgorithmEx/AlgorithmEx/Debug/p1074.obj
Binary file not shown.
Binary file added C/AlgorithmEx/AlgorithmEx/Debug/vc142.idb
Binary file not shown.
Binary file added C/AlgorithmEx/AlgorithmEx/Debug/vc142.pdb
Binary file not shown.
48 changes: 48 additions & 0 deletions C/AlgorithmEx/AlgorithmEx/p1074.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <stdio.h>
#include <math.h>

int N, r, c;
int Count;
int result;
int resu;
void visit(int x, int y , int z )
{
if (z == 1)
{
if (x == r && y == c)
{
//printf("%d %d\n", r, c);
result = Count;
return;

}
//printf("x =%d , y = %d, c = %d\n", x, y, Count);
Count++;
}


else {
int mid = z / 2;
visit(x, y, mid);
visit(x, y + mid, mid);
visit(x + mid, y, mid);
visit(x + mid, y+mid, mid);
}

}

int main()
{
N = 0;
r = 0;
c = 0;
Count = 0;
scanf("%d %d %d", &N, &r, &c);

// ��Ʈ���� ������.
int Size = (int)pow(2.0, N);

visit(0, 0, Size);
printf("%d", result);

}
Binary file added C/AlgorithmEx/Debug/AlgorithmEx.exe
Binary file not shown.
Binary file added C/AlgorithmEx/Debug/AlgorithmEx.pdb
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions C/Study/Study/Study.vcxproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
</Project>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added C/p1629/.vs/p1629/v16/.suo
Binary file not shown.
Binary file added C/p1629/.vs/p1629/v16/Browse.VC.db
Binary file not shown.
Binary file not shown.
Binary file added C/p1629/Debug/p1629.exe
Binary file not shown.
Binary file added C/p1629/Debug/p1629.pdb
Binary file not shown.
31 changes: 31 additions & 0 deletions C/p1629/p1629.sln
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.31424.327
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "p1629", "p1629\p1629.vcxproj", "{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}"
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
{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}.Debug|x64.ActiveCfg = Debug|x64
{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}.Debug|x64.Build.0 = Debug|x64
{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}.Debug|x86.ActiveCfg = Debug|Win32
{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}.Debug|x86.Build.0 = Debug|Win32
{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}.Release|x64.ActiveCfg = Release|x64
{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}.Release|x64.Build.0 = Release|x64
{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}.Release|x86.ActiveCfg = Release|Win32
{285E08D7-AC2B-4DA4-9618-C138D7AAD40E}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {22FC0E12-46DC-4ABF-B55B-4656B921E023}
EndGlobalSection
EndGlobal
Loading