發表文章

目前顯示的是 7月, 2020的文章

C# check prime

using  System; using  System.Collections.Generic; using  System.IO; class  Solution {       static   bool  isPrime( int  n) {          for ( int  i= 2 ;i<=Math.Sqrt(n);i++) {              if (n%i== 0 ) {                  return   false ;             }         }          return   true ;     }      static   void  Main(String[] args) {          /* Enter your code here. Read input from STDIN. Print output to STDOUT. Yo...

C# Generics example

using  System; class  Printer {      /**     *    Name: PrintArray     *    Print each element of the generic array on a new line. Do not return anything.     *    @param A generic array     **/      // Write your code here       static   void  PrintArray<T> (System.Collections.Generic.IList<T> coll)     {          foreach  (T item  in  coll)         {             Console.WriteLine(item.ToString() +  " " );       ...

Bubble Search

using  System; using  System.Collections.Generic; using  System.IO; using  System.Linq; class  Solution {      private   static   int [] array;      static   void  Main(String[] args) {          int  n = Convert.ToInt32(Console.ReadLine());          string [] a_temp = Console.ReadLine().Split( ' ' );          int [] a = Array.ConvertAll(a_temp,Int32.Parse);          // Write Your Code Here         array =  new   int [n];          for  ( int  i =  0 ; i < n; i++) {          ...

白色恐怖紀念館

圖片
今日到了白色恐怖紀念館. 一個政府變成極權只是一刻的事, 看一看香港, 就好像水霸, 起初也能支撐, 但一刻間, 所有也沖走, 法治, 人權, 自由. 其實, 我想也知, 在白色恐怖, 台灣人是怎樣生活, 他們又是否真的"生活如常", 最可怕的是讀書那一班, 或者眼見社會不公, 也改變不了的人.  在很多人眼中, 看到的可能只是數字, 但在我眼中是他們被奪去的青春或者生命, 1950-1983 代表囚禁的年份, 有些紅色字代表死在獄中. 除了他們, 還有他們的家人, 那一份無奈的哭泣.  天陰下, 還有一群親友, 受害者的父母親, 太太, 兒女. 因為他/她可能家庭的重心, 正直盛年的他, 一下子令家庭没有了依靠, 或者爸爸突然不在身邊, 那份傷害不是文字, 三言兩語可以寫下來, 當你一個生在外地, 想念著自己家人小孩, 你就只是想抱抱孩兒, 原來已經是一種奢侈的想法, 那一個奢侈想法, 唯一可以做的就是等待.  有一個受害者的女兒, 父被槍決, 母自殺, 她一手有嫲嫲湊大, 有一次她看到別的小朋友食蘋果, 她望著小朋友食蘋果, 因為她那時很窮, 窮得没有飯吃, 那個小朋友笑她, 被她嫲嫲知道, 嫲嫲打了她一頓, 說, 做人要有志氣, 明不明白. 到了她長大, 看見父被行刑時, 槍決的相, 相中的父在笑.  在這白色恐怖下, 38 年的人和事, 又多少没有紀錄下來, 如文革般扣帽子的又有多少. 有多少人是死得不明不白. 又多少人渣在安享天年, 無道的人可其多, 讀書...累人................... 當法治成為當權者的工具, 法治還有什麼用, 我們還要法治幹什麼, 不過是誰有槍炮, 誰說了算. 其實, 這個時期, 原住民更慘.  .

Linq int Max and min

using  System; using  System.Linq; class  Difference {      private   int [] elements;      public   int  maximumDifference;      public  Difference( int [] a){          this .elements = a;     }      // Add your code here      public   void  computeDifference(){          var  min = elements.Min( x=>x);          var  max = elements.Max( x=>x);          var  diff = max - min;          this .maximumDifference = diff;     } }  // End of Difference Class class ...