2015-05-06から1日間の記事一覧

Project Euler 50

PE

Problem 50 using System; using System.Collections.Generic; using System.Linq; class Prime { public static List<int> Sieve(int n) { // n 以下の全ての素数を求める bool[] tab = new bool[n+1]; for (int i = 0; i < tab.Length; i++) tab[i] = true; int</int>…

Project Euler 49

PE

Problem 49 using System; using System.Collections.Generic; using System.Linq; class Prime { public static List<int> Sieve(int n) { // n 以下の全ての素数を求める bool[] tab = new bool[n+1]; for (int i = 0; i < tab.Length; i++) tab[i] = true; int</int>…

同じ数字のみからなる文字列かどうか(正規表現)

文字列が "111" や "888888" のように全て同じ数字であるかを調べるプログラムです。 正規表現を使っています。 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; class Program { static void M…