Skip to content

Commit 19a6d59

Browse files
committed
Add code for leetcode728.
Add C# code for leetcode728.
1 parent f0727a8 commit 19a6d59

28 files changed

+372
-0
lines changed

leetcode728/.vs/leetcode728/v16/.suo

25.5 KB
Binary file not shown.

leetcode728/.vs/leetcode728/v16/Server/sqlite3/db.lock

Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.

leetcode728/leetcode728.sln

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29009.5
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "leetcode728", "leetcode728\leetcode728.csproj", "{ED25F305-93F0-40E0-BABA-E214ED9A8632}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{ED25F305-93F0-40E0-BABA-E214ED9A8632}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{ED25F305-93F0-40E0-BABA-E214ED9A8632}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{ED25F305-93F0-40E0-BABA-E214ED9A8632}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{ED25F305-93F0-40E0-BABA-E214ED9A8632}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {A67AA485-7FD1-4B92-B2DE-21D04F6CAA12}
24+
EndGlobalSection
25+
EndGlobal

leetcode728/leetcode728/Program.cs

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Collections.Generic;
3+
4+
namespace leetcode728
5+
{
6+
public class Solution
7+
{
8+
public IList<int> SelfDividingNumbers(int left, int right)
9+
{
10+
List<int> list = new List<int>();
11+
for (int i = left; i <= right; ++i)
12+
{
13+
if (isSelfDiv(i))
14+
list.Add(i);
15+
}
16+
return list;
17+
}
18+
19+
bool isSelfDiv(int n)
20+
{
21+
if (n < 10)
22+
return true;
23+
if (n % 10 == 0)
24+
return false;
25+
26+
int t = n;
27+
while (t != 0)
28+
{
29+
int rem = t % 10;
30+
if (rem == 0)
31+
return false;
32+
if (rem > 1 && n % rem != 0) // 原数不是末位数字倍数的数需要排除
33+
return false;
34+
t /= 10;
35+
}
36+
return true;
37+
}
38+
39+
static void Main(string[] args)
40+
{
41+
var sol = new Solution();
42+
var res = sol.SelfDividingNumbers(5, 50);
43+
foreach (var item in res)
44+
Console.WriteLine(item);
45+
}
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"runtimeTarget": {
3+
"name": ".NETCoreApp,Version=v3.0",
4+
"signature": ""
5+
},
6+
"compilationOptions": {},
7+
"targets": {
8+
".NETCoreApp,Version=v3.0": {
9+
"leetcode728/1.0.0": {
10+
"dependencies": {
11+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost": "3.0.0-preview5-27617-04"
12+
},
13+
"runtime": {
14+
"leetcode728.dll": {}
15+
}
16+
},
17+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost/3.0.0-preview5-27617-04": {}
18+
}
19+
},
20+
"libraries": {
21+
"leetcode728/1.0.0": {
22+
"type": "project",
23+
"serviceable": false,
24+
"sha512": ""
25+
},
26+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost/3.0.0-preview5-27617-04": {
27+
"type": "package",
28+
"serviceable": true,
29+
"sha512": "sha512-x+Vg5f2FW62/TbvlN++sDmnw+rS8q0TtnTRTn0JidDqwg3fwu6F9WXn9WgtXWGINV1OO8a7UVIioMTpnwbzBOQ==",
30+
"path": "runtime.win-x64.microsoft.netcore.dotnetapphost/3.0.0-preview5-27617-04",
31+
"hashPath": "runtime.win-x64.microsoft.netcore.dotnetapphost.3.0.0-preview5-27617-04.nupkg.sha512"
32+
}
33+
}
34+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"runtimeOptions": {
3+
"additionalProbingPaths": [
4+
"C:\\Users\\Bruce\\.dotnet\\store\\|arch|\\|tfm|",
5+
"C:\\Users\\Bruce\\.nuget\\packages",
6+
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
7+
]
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"runtimeOptions": {
3+
"tfm": "netcoreapp3.0",
4+
"framework": {
5+
"name": "Microsoft.NETCore.App",
6+
"version": "3.0.0-preview5-27617-04"
7+
}
8+
}
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//------------------------------------------------------------------------------
2+
// <auto-generated>
3+
// This code was generated by a tool.
4+
// Runtime Version:4.0.30319.42000
5+
//
6+
// Changes to this file may cause incorrect behavior and will be lost if
7+
// the code is regenerated.
8+
// </auto-generated>
9+
//------------------------------------------------------------------------------
10+
11+
using System;
12+
using System.Reflection;
13+
14+
[assembly: System.Reflection.AssemblyCompanyAttribute("leetcode728")]
15+
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
16+
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
17+
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
18+
[assembly: System.Reflection.AssemblyProductAttribute("leetcode728")]
19+
[assembly: System.Reflection.AssemblyTitleAttribute("leetcode728")]
20+
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
21+
22+
// Generated by the MSBuild WriteCodeFragment class.
23+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
477650b2c405e63e2f824057c923ce5ea8c5a101
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0fcbdcd36a1ed7738495b93a2167489f20961af5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
D:\Coding\csLeetcode\leetcode728\leetcode728\bin\Debug\netcoreapp3.0\leetcode728.exe
2+
D:\Coding\csLeetcode\leetcode728\leetcode728\bin\Debug\netcoreapp3.0\leetcode728.deps.json
3+
D:\Coding\csLeetcode\leetcode728\leetcode728\bin\Debug\netcoreapp3.0\leetcode728.runtimeconfig.json
4+
D:\Coding\csLeetcode\leetcode728\leetcode728\bin\Debug\netcoreapp3.0\leetcode728.runtimeconfig.dev.json
5+
D:\Coding\csLeetcode\leetcode728\leetcode728\bin\Debug\netcoreapp3.0\leetcode728.dll
6+
D:\Coding\csLeetcode\leetcode728\leetcode728\bin\Debug\netcoreapp3.0\leetcode728.pdb
7+
D:\Coding\csLeetcode\leetcode728\leetcode728\obj\Debug\netcoreapp3.0\leetcode728.csprojAssemblyReference.cache
8+
D:\Coding\csLeetcode\leetcode728\leetcode728\obj\Debug\netcoreapp3.0\leetcode728.csproj.CoreCompileInputs.cache
9+
D:\Coding\csLeetcode\leetcode728\leetcode728\obj\Debug\netcoreapp3.0\leetcode728.AssemblyInfoInputs.cache
10+
D:\Coding\csLeetcode\leetcode728\leetcode728\obj\Debug\netcoreapp3.0\leetcode728.AssemblyInfo.cs
11+
D:\Coding\csLeetcode\leetcode728\leetcode728\obj\Debug\netcoreapp3.0\leetcode728.dll
12+
D:\Coding\csLeetcode\leetcode728\leetcode728\obj\Debug\netcoreapp3.0\leetcode728.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"version": 1,
3+
"dgSpecHash": "YDxQPpGgcG7BuvxC+l0ziMS+EKLPFwx88r5m2S6VJgabHCjXDEHf9sVer1WoITyUb7Cl/V7J6pXBz94gKtDpIg==",
4+
"success": true
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"format": 1,
3+
"restore": {
4+
"D:\\Coding\\csLeetcode\\leetcode728\\leetcode728\\leetcode728.csproj": {}
5+
},
6+
"projects": {
7+
"D:\\Coding\\csLeetcode\\leetcode728\\leetcode728\\leetcode728.csproj": {
8+
"version": "1.0.0",
9+
"restore": {
10+
"projectUniqueName": "D:\\Coding\\csLeetcode\\leetcode728\\leetcode728\\leetcode728.csproj",
11+
"projectName": "leetcode728",
12+
"projectPath": "D:\\Coding\\csLeetcode\\leetcode728\\leetcode728\\leetcode728.csproj",
13+
"packagesPath": "C:\\Users\\Bruce\\.nuget\\packages\\",
14+
"outputPath": "D:\\Coding\\csLeetcode\\leetcode728\\leetcode728\\obj\\",
15+
"projectStyle": "PackageReference",
16+
"fallbackFolders": [
17+
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
18+
],
19+
"configFilePaths": [
20+
"C:\\Users\\Bruce\\AppData\\Roaming\\NuGet\\NuGet.Config",
21+
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
22+
],
23+
"originalTargetFrameworks": [
24+
"netcoreapp3.0"
25+
],
26+
"sources": {
27+
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
28+
"https://api.nuget.org/v3/index.json": {},
29+
"https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json": {},
30+
"https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json": {},
31+
"https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json": {},
32+
"https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json": {},
33+
"https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json": {},
34+
"https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json": {}
35+
},
36+
"frameworks": {
37+
"netcoreapp3.0": {
38+
"projectReferences": {}
39+
}
40+
},
41+
"warningProperties": {
42+
"warnAsError": [
43+
"NU1605"
44+
]
45+
}
46+
},
47+
"frameworks": {
48+
"netcoreapp3.0": {
49+
"dependencies": {
50+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost": {
51+
"include": "None",
52+
"suppressParent": "All",
53+
"target": "Package",
54+
"version": "[3.0.0-preview5-27617-04, )",
55+
"autoReferenced": true
56+
}
57+
},
58+
"imports": [
59+
"net461"
60+
],
61+
"assetTargetFallback": true,
62+
"warn": true,
63+
"frameworkReferences": [
64+
"Microsoft.NETCore.App"
65+
]
66+
}
67+
}
68+
}
69+
}
70+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
4+
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
5+
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
6+
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
7+
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
8+
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Bruce\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder</NuGetPackageFolders>
9+
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
10+
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">5.1.0</NuGetToolVersion>
11+
</PropertyGroup>
12+
<PropertyGroup>
13+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
14+
</PropertyGroup>
15+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
5+
</PropertyGroup>
6+
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"version": 3,
3+
"targets": {
4+
".NETCoreApp,Version=v3.0": {
5+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost/3.0.0-preview5-27617-04": {
6+
"type": "package",
7+
"runtimeTargets": {
8+
"runtimes/win-x64/native/_._": {
9+
"assetType": "native",
10+
"rid": "win-x64"
11+
}
12+
}
13+
}
14+
}
15+
},
16+
"libraries": {
17+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost/3.0.0-preview5-27617-04": {
18+
"sha512": "x+Vg5f2FW62/TbvlN++sDmnw+rS8q0TtnTRTn0JidDqwg3fwu6F9WXn9WgtXWGINV1OO8a7UVIioMTpnwbzBOQ==",
19+
"type": "package",
20+
"path": "runtime.win-x64.microsoft.netcore.dotnetapphost/3.0.0-preview5-27617-04",
21+
"files": [
22+
".nupkg.metadata",
23+
".signature.p7s",
24+
"LICENSE.TXT",
25+
"THIRD-PARTY-NOTICES.TXT",
26+
"runtime.win-x64.microsoft.netcore.dotnetapphost.3.0.0-preview5-27617-04.nupkg.sha512",
27+
"runtime.win-x64.microsoft.netcore.dotnetapphost.nuspec",
28+
"runtimes/win-x64/native/apphost.exe",
29+
"runtimes/win-x64/native/comhost.dll",
30+
"runtimes/win-x64/native/ijwhost.dll",
31+
"runtimes/win-x64/native/ijwhost.lib",
32+
"version.txt"
33+
]
34+
}
35+
},
36+
"projectFileDependencyGroups": {
37+
".NETCoreApp,Version=v3.0": [
38+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost >= 3.0.0-preview5-27617-04"
39+
]
40+
},
41+
"packageFolders": {
42+
"C:\\Users\\Bruce\\.nuget\\packages\\": {},
43+
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {}
44+
},
45+
"project": {
46+
"version": "1.0.0",
47+
"restore": {
48+
"projectUniqueName": "D:\\Coding\\csLeetcode\\leetcode728\\leetcode728\\leetcode728.csproj",
49+
"projectName": "leetcode728",
50+
"projectPath": "D:\\Coding\\csLeetcode\\leetcode728\\leetcode728\\leetcode728.csproj",
51+
"packagesPath": "C:\\Users\\Bruce\\.nuget\\packages\\",
52+
"outputPath": "D:\\Coding\\csLeetcode\\leetcode728\\leetcode728\\obj\\",
53+
"projectStyle": "PackageReference",
54+
"fallbackFolders": [
55+
"C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder"
56+
],
57+
"configFilePaths": [
58+
"C:\\Users\\Bruce\\AppData\\Roaming\\NuGet\\NuGet.Config",
59+
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
60+
],
61+
"originalTargetFrameworks": [
62+
"netcoreapp3.0"
63+
],
64+
"sources": {
65+
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
66+
"https://api.nuget.org/v3/index.json": {},
67+
"https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore-tooling/index.json": {},
68+
"https://dotnetfeed.blob.core.windows.net/aspnet-aspnetcore/index.json": {},
69+
"https://dotnetfeed.blob.core.windows.net/aspnet-entityframeworkcore/index.json": {},
70+
"https://dotnetfeed.blob.core.windows.net/aspnet-extensions/index.json": {},
71+
"https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json": {},
72+
"https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json": {}
73+
},
74+
"frameworks": {
75+
"netcoreapp3.0": {
76+
"projectReferences": {}
77+
}
78+
},
79+
"warningProperties": {
80+
"warnAsError": [
81+
"NU1605"
82+
]
83+
}
84+
},
85+
"frameworks": {
86+
"netcoreapp3.0": {
87+
"dependencies": {
88+
"runtime.win-x64.Microsoft.NETCore.DotNetAppHost": {
89+
"include": "None",
90+
"suppressParent": "All",
91+
"target": "Package",
92+
"version": "[3.0.0-preview5-27617-04, )",
93+
"autoReferenced": true
94+
}
95+
},
96+
"imports": [
97+
"net461"
98+
],
99+
"assetTargetFallback": true,
100+
"warn": true,
101+
"frameworkReferences": [
102+
"Microsoft.NETCore.App"
103+
]
104+
}
105+
}
106+
}
107+
}

0 commit comments

Comments
 (0)