AtCoder Beginner Contest 003

Submission #7467186

Source codeソースコード

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace kp
{
    public class Program
    {
        //static long[,] cmb;
        static int MAX_INT = 1000000007;
        static void Main(string[] args)
        {
            //int N = Int32.Parse(Console.ReadLine());
            int[] input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
            int R = input[0];
            int C = input[1];
            input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
            int X = input[0];
            int Y = input[1];
            input = Console.ReadLine().Split().Select(p => int.Parse(p)).ToArray();
            int D = input[0];
            int L = input[1];

            // R*Cの区画の中にX*Yの区画の取り方は
            int a = (R-X+1)*(C-Y+1);
//Console.WriteLine(a + " math");
            // X*YのますからDを置く場所を決める
            // → X*Y[Comb]D
        //  Console.WriteLine((X*Y) + " " + D);
            int b = Combination(X*Y, D);
            // 残りの X*Y-DのますからLを置く場所を決める
            // → X*Y-D[Comb]L

          //Console.WriteLine((X*Y-D) + " " +  L);
            int c = Combination(X*Y-D, L);
//Console.WriteLine(a + " " + b + " " + c);
            // a*b*cが答えだけど・・・
            long ret = (long)a%MAX_INT;
            ret = (ret*(long)b)%MAX_INT;
            ret = (ret*(long)c)%MAX_INT;

            Console.WriteLine(ret + "");
        }

        static int Combination(int i, int j)
        {
          // iCjを求める
          long[,] comb = new long[i+2, i+2];
          comb[0,0] = 1;
          comb[1,0] = 1;
          comb[1,1] = 1;
          for(int k = 2; k<=i; k++)
          {
            for(int l = 0; l<= k; l++)
            {
              if(l==0)
              {
                comb[k,l] = 1;
              }
              else
              {
                comb[k,l] = (comb[k-1, l-1] + comb[k-1, l])%MAX_INT;
              }
            }
          }
          /*
Console.WriteLine("comb");
          for(int ii = 0; ii<=i; ii++)
          {
            for(int jj = 0; jj<=i; jj++)
            {
              Console.Write(comb[ii,jj] + " ");
            }
            Console.WriteLine();
          }*/
          return (int)comb[i,j];
        }

    }
}

Submission

Task問題 D - AtCoder社の冬
User nameユーザ名 keikochan
Created time投稿日時
Language言語 C# (Mono 4.6.2.0)
Status状態 WA
Score得点 100
Source lengthソースコード長 2523 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
sub 100 / 100 00_sample_01E.txt,00_sample_02E.txt,00_sample_03E.txt,test_03E.txt,test_04E.txt,test_07E.txt,test_08E.txt,test_11E.txt,test_12E.txt,test_15E.txt,test_16E.txt,test_19E.txt,test_20E.txt,test_23E.txt,test_24E.txt,test_27E.txt,test_28E.txt,test_31E.txt,test_32E.txt,test_36E.txt,test_37E.txt,test_38E.txt,test_39E.txt,test_45E.txt,test_47E.txt
All 0 / 1 00_sample_01E.txt,00_sample_02E.txt,00_sample_03E.txt,00_sample_04.txt,test_01.txt,test_02.txt,test_03E.txt,test_04E.txt,test_05.txt,test_06.txt,test_07E.txt,test_08E.txt,test_09.txt,test_10.txt,test_11E.txt,test_12E.txt,test_13.txt,test_14.txt,test_15E.txt,test_16E.txt,test_17.txt,test_18.txt,test_19E.txt,test_20E.txt,test_21.txt,test_22.txt,test_23E.txt,test_24E.txt,test_25.txt,test_26.txt,test_27E.txt,test_28E.txt,test_29.txt,test_30.txt,test_31E.txt,test_32E.txt,test_33.txt,test_34.txt,test_35.txt,test_36E.txt,test_37E.txt,test_38E.txt,test_39E.txt,test_40.txt,test_41.txt,test_42.txt,test_43.txt,test_44.txt,test_45E.txt,test_46.txt,test_47E.txt,test_48.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
00_sample_01E.txt AC 24 ms 13268 KB
00_sample_02E.txt AC 23 ms 9300 KB
00_sample_03E.txt AC 24 ms 11344 KB
00_sample_04.txt WA
test_01.txt AC 24 ms 13356 KB
test_02.txt WA
test_03E.txt AC 24 ms 11348 KB
test_04E.txt AC 28 ms 15584 KB
test_05.txt WA
test_06.txt WA
test_07E.txt AC 24 ms 11332 KB
test_08E.txt AC 25 ms 13792 KB
test_09.txt WA
test_10.txt WA
test_11E.txt AC 25 ms 11616 KB
test_12E.txt AC 27 ms 13024 KB
test_13.txt WA
test_14.txt AC 42 ms 25696 KB
test_15E.txt AC 29 ms 16224 KB
test_16E.txt AC 41 ms 20832 KB
test_17.txt WA
test_18.txt WA
test_19E.txt AC 23 ms 11220 KB
test_20E.txt AC 24 ms 11284 KB
test_21.txt WA
test_22.txt WA
test_23E.txt AC 23 ms 9300 KB
test_24E.txt AC 34 ms 17760 KB
test_25.txt WA
test_26.txt WA
test_27E.txt AC 27 ms 13152 KB
test_28E.txt AC 31 ms 15584 KB
test_29.txt WA
test_30.txt WA
test_31E.txt AC 25 ms 13792 KB
test_32E.txt AC 42 ms 23008 KB
test_33.txt WA
test_34.txt WA
test_35.txt WA
test_36E.txt AC 24 ms 11348 KB
test_37E.txt AC 23 ms 9300 KB
test_38E.txt AC 24 ms 11348 KB
test_39E.txt AC 24 ms 11348 KB
test_40.txt WA
test_41.txt WA
test_42.txt WA
test_43.txt WA
test_44.txt WA
test_45E.txt AC 24 ms 11348 KB
test_46.txt WA
test_47E.txt AC 24 ms 11220 KB
test_48.txt WA