Hash Tables and Hash Functions
Algorithm 2019. 4. 2. 23:24https://referencesource.microsoft.com/#mscorlib/system/collections/hashtable.cs,10fefb6e0ae510dd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Text;
namespace ConsoleApp10
{
class Program
{
static void Main(string[] args)
{
// TODO: 여기에 응용 프로그램을 시작하는 코드를 추가합니다.
string str = "홍길동";
char[] charArray = str.ToCharArray();
Console.WriteLine("Char Array");
// for(int i=0;i<charArray.Length;i++)
// Console.WriteLine((int)charArray[i]);
foreach (char a in charArray)
Console.WriteLine("{0}", (int)a);
Console.WriteLine();
byte[] byteArray = System.Text.ASCIIEncoding.Default.GetBytes(str);
Console.WriteLine("Byte Array");
// for(int i=0;i<byteArray.Length;i++)
// Console.WriteLine(byteArray[i]);
int sum = 0;
foreach (char a in byteArray) {
sum += (int)a;
Console.WriteLine("{0}", (int)a);
}
Console.WriteLine("sum: {0}", sum % 11);
}
}
}
|
'Algorithm' 카테고리의 다른 글
[백준] 11047 동전 0 (진행중) (0) | 2019.08.13 |
---|---|
[백준] ATM 11399 (0) | 2019.08.12 |
설탕 배달 (0) | 2019.06.11 |
그래프 (0) | 2019.06.11 |
A* Pathfinding for Beginner By Patrick Lester (0) | 2019.05.22 |