Submission #202464
Source Code Expand
class Program { static void Main(string[] args) { //定数 int max = 2024; int minimum = 1944; int result = 0; int arrayCNT = 0; int subCnt = 0; int subCnt2 = 1; List<string> arraySTR = new List<string>(); //九九の二次元配列を定義する。 int[,] array2D = new int[9,9 ] { {1, 2,3,4,5,6,7,8,9 }, {2,4,6,8,10,12,14,16,18}, {3,6,9,12,15,18,21,24,27}, {4,8,12,16,20,24,28,32,36}, {5,10,15,20,25,30,35,40,45}, {6,12,18,24,30,36,42,48,54}, {7,14,21,28,35,42,49,56,63}, {8,16,24,32,40,48,56,64,72}, {9,18,27,36,45,54,63,72,81}, }; // 整数の入力 2014 int a = int.Parse(Console.ReadLine()); //足りていない 数値の パターン を洗い出して 文字列を作成する。 //2024 から 入力値を引く result = max - a; //配列位置の特定 foreach (int array in array2D) { //カウントアップ arrayCNT++; subCnt++; //値と一致した場合 if (array == result) { arraySTR.Add(subCnt.ToString() + " x " + subCnt2.ToString()); } if (subCnt == 9) { subCnt = 0; subCnt2++; } } //出力 foreach (string str in arraySTR) { Console.WriteLine(str); } } }
Submission Info
Submission Time | |
---|---|
Task | C - 九九足し算 |
User | mbmpw757 |
Language | C# (Mono 2.10.8.1) |
Score | 0 |
Code Size | 2146 Byte |
Status | CE |
Compile Error
./Main.cs(15,13): error CS0246: The type or namespace name `List' could not be found. Are you missing a using directive or an assembly reference? ./Main.cs(30,31): error CS0103: The name `Console' does not exist in the current context ./Main.cs(30,25): error CS1502: The best overloaded method match for `int.Parse(string)' has some invalid arguments /usr/lib/mono/4.0/mscorlib.dll (Location of the symbol related to previous error) ./Main.cs(30,25): error CS1503: Argument `#1' cannot convert `object' expression to type `string' ./Main.cs(49,21): error CS0841: A local variable `arraySTR' cannot be used before it is declared ./Main.cs(62,36): error CS0841: A local variable `arraySTR' cannot be used before it is declared