diff --git a/数组整合/App.config b/数组整合/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/数组整合/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/数组整合/Program.cs b/数组整合/Program.cs new file mode 100644 index 0000000..97b10b4 --- /dev/null +++ b/数组整合/Program.cs @@ -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 A = new List { "A", "C", "E", "G", "I", "J", "L" }; + List B = new List { "A", "B", "C", "D", "E", "F", "G" }; + List C = getResult(A, B); + printList(A); + printList(B); + printList(C); + Console.Read(); + } + + static void printList(List list) + { + StringBuilder sb = new StringBuilder(); + foreach (var item in list) + { + sb.Append(item + " "); + } + Console.WriteLine(sb.ToString()); + } + + static List getResult(List notExist, List exist) + { + List result = new List(); + 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; + } + } +} diff --git a/数组整合/Properties/AssemblyInfo.cs b/数组整合/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d11cab2 --- /dev/null +++ b/数组整合/Properties/AssemblyInfo.cs @@ -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")] diff --git a/数组整合/数组整合.csproj b/数组整合/数组整合.csproj new file mode 100644 index 0000000..218d672 --- /dev/null +++ b/数组整合/数组整合.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {647E42BC-B799-4C53-8B0E-1A70C58DC005} + Exe + Properties + 数组整合 + 数组整合 + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/数组连加/App.config b/数组连加/App.config new file mode 100644 index 0000000..8e15646 --- /dev/null +++ b/数组连加/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/数组连加/Program.cs b/数组连加/Program.cs new file mode 100644 index 0000000..d6e2db3 --- /dev/null +++ b/数组连加/Program.cs @@ -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); + } + } + } +} diff --git a/数组连加/Properties/AssemblyInfo.cs b/数组连加/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f0f8d7d --- /dev/null +++ b/数组连加/Properties/AssemblyInfo.cs @@ -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")] diff --git a/数组连加/数组连加.csproj b/数组连加/数组连加.csproj new file mode 100644 index 0000000..e648fa4 --- /dev/null +++ b/数组连加/数组连加.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {AA3F10A2-EC7D-429A-AA6D-90E38D500866} + Exe + Properties + 数组连加 + 数组连加 + v4.5 + 512 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/算法测试.sln b/算法测试.sln index 3fa72e9..f126632 100644 --- a/算法测试.sln +++ b/算法测试.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