add: 220222 [csharp]

This commit is contained in:
Lam Haoyin 2022-02-22 18:12:57 +08:00
parent ca1327b9dc
commit ecb3d135df
No known key found for this signature in database
GPG Key ID: 8C089CB1A2B7544F
3 changed files with 34 additions and 0 deletions

View File

@ -4,6 +4,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cn-0221", "cn-0221\cn-0221.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "int-0221", "int-0221\int-0221.csproj", "{9CCC88EF-7FA3-4406-B41B-EAC86AEF8760}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "int-0222", "int-0222\int-0222.csproj", "{70C4BB01-2740-48F5-911A-FEB254C1AAD5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -18,5 +20,9 @@ Global
{9CCC88EF-7FA3-4406-B41B-EAC86AEF8760}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CCC88EF-7FA3-4406-B41B-EAC86AEF8760}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9CCC88EF-7FA3-4406-B41B-EAC86AEF8760}.Release|Any CPU.Build.0 = Release|Any CPU
{70C4BB01-2740-48F5-911A-FEB254C1AAD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70C4BB01-2740-48F5-911A-FEB254C1AAD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70C4BB01-2740-48F5-911A-FEB254C1AAD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70C4BB01-2740-48F5-911A-FEB254C1AAD5}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,17 @@
namespace int_0222;
public class Solution {
public int TitleToNumber(string columnTitle) {
int ret = 0;
foreach (char c in columnTitle)
ret = (26 * ret) - 'A' + c + 1;
return ret;
}
}
public class Runner {
public static void Main() {
var s = new Solution();
Console.WriteLine(s.TitleToNumber("ZY"));
}
}

View File

@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>int_0222</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>