mirror of
https://e.coding.net/circlecloud/Algorithm-Test.git
synced 2025-09-01 06:57:06 +00:00
新算法提交...
This commit is contained in:
6
数组整合/App.config
Normal file
6
数组整合/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
52
数组整合/Program.cs
Normal file
52
数组整合/Program.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace 数组整合
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
List<String> A = new List<string> { "A", "C", "E", "G", "I", "J", "L" };
|
||||
List<String> B = new List<string> { "A", "B", "C", "D", "E", "F", "G" };
|
||||
List<String> C = getResult(A, B);
|
||||
printList(A);
|
||||
printList(B);
|
||||
printList(C);
|
||||
Console.Read();
|
||||
}
|
||||
|
||||
static void printList(List<String> list)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (var item in list)
|
||||
{
|
||||
sb.Append(item + " ");
|
||||
}
|
||||
Console.WriteLine(sb.ToString());
|
||||
}
|
||||
|
||||
static List<String> getResult(List<String> notExist, List<String> exist)
|
||||
{
|
||||
List<String> result = new List<string>();
|
||||
foreach (var e in exist)
|
||||
{
|
||||
Boolean has = false;
|
||||
foreach (var ne in notExist)
|
||||
{
|
||||
if (ne == e)
|
||||
{
|
||||
has = true;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
result.Add(e);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
36
数组整合/Properties/AssemblyInfo.cs
Normal file
36
数组整合/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("数组整合")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("数组整合")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("27438380-9f12-45ac-af35-48a78c6537a8")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
58
数组整合/数组整合.csproj
Normal file
58
数组整合/数组整合.csproj
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{647E42BC-B799-4C53-8B0E-1A70C58DC005}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>数组整合</RootNamespace>
|
||||
<AssemblyName>数组整合</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
6
数组连加/App.config
Normal file
6
数组连加/App.config
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
27
数组连加/Program.cs
Normal file
27
数组连加/Program.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace 数组连加
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
for (int i = 0; i <= 30; i++)
|
||||
{
|
||||
Console.WriteLine(getsum(i));
|
||||
}
|
||||
}
|
||||
static int getsum(int n)
|
||||
{
|
||||
if (n < 2)
|
||||
return 1;
|
||||
else{
|
||||
return getsum(n - 2) + getsum(n - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
数组连加/Properties/AssemblyInfo.cs
Normal file
36
数组连加/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("数组连加")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("数组连加")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("b6736403-7bc7-44cb-9268-7553fb968291")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
58
数组连加/数组连加.csproj
Normal file
58
数组连加/数组连加.csproj
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{AA3F10A2-EC7D-429A-AA6D-90E38D500866}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>数组连加</RootNamespace>
|
||||
<AssemblyName>数组连加</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
68
算法测试.sln
68
算法测试.sln
@ -1,28 +1,40 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "水仙花数字", "水仙花数字\水仙花数字.csproj", "{91A7507F-1204-44CA-8D3E-C813FAA0DC07}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pi", "Pi\Pi.csproj", "{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{91A7507F-1204-44CA-8D3E-C813FAA0DC07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{91A7507F-1204-44CA-8D3E-C813FAA0DC07}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{91A7507F-1204-44CA-8D3E-C813FAA0DC07}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{91A7507F-1204-44CA-8D3E-C813FAA0DC07}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.40629.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "水仙花数字", "水仙花数字\水仙花数字.csproj", "{91A7507F-1204-44CA-8D3E-C813FAA0DC07}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pi", "Pi\Pi.csproj", "{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "数组整合", "数组整合\数组整合.csproj", "{647E42BC-B799-4C53-8B0E-1A70C58DC005}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "数组连加", "数组连加\数组连加.csproj", "{AA3F10A2-EC7D-429A-AA6D-90E38D500866}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{91A7507F-1204-44CA-8D3E-C813FAA0DC07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{91A7507F-1204-44CA-8D3E-C813FAA0DC07}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{91A7507F-1204-44CA-8D3E-C813FAA0DC07}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{91A7507F-1204-44CA-8D3E-C813FAA0DC07}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0FB17AAF-16C4-4AEE-A1F9-F272C407F57A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{647E42BC-B799-4C53-8B0E-1A70C58DC005}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{647E42BC-B799-4C53-8B0E-1A70C58DC005}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{647E42BC-B799-4C53-8B0E-1A70C58DC005}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{647E42BC-B799-4C53-8B0E-1A70C58DC005}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AA3F10A2-EC7D-429A-AA6D-90E38D500866}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AA3F10A2-EC7D-429A-AA6D-90E38D500866}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AA3F10A2-EC7D-429A-AA6D-90E38D500866}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AA3F10A2-EC7D-429A-AA6D-90E38D500866}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
Reference in New Issue
Block a user