2015-03-08から1日間の記事一覧

一日一プロ

アルゴリズムとデータ構造 問題 n個の数字R0〜Rn-1が与えられる。 Rj - Ri (i using System; using System.Collections.Generic; namespace MaximumProfit { class MainClass { const int MaximumProfit = 200000; public static void Main (string[] args) …

よく使いそうなコードまとめ(4)

動的配列 List using System.Collections.Generic; var R = new List<int>(); /*宣言 */ R.Add(int.Parse (Console.ReadLine ())); /* 要素追加 */ Console.WriteLine ("{0}", R[0]); /* 要素抽出 */ 定数定義 const int DEFINE 5 Max, Min関数 Math.Max( A, B );</int>…

C#でプロコン入力

C#

C#の標準入力処理 /* 標準入力より' 'で分割しstr配列へ格納 */ string[] str = Console.ReadLine ().Split (' '); /* 1番目の要素をint型に変換しNへ格納 */ int N = int.Parse (str [0]); /* 2番目の要素をint型に変換しMへ格納 */ int M = int.Parse (str…