結果

問題 No.437 cwwゲーム
ユーザー jousenjousen
提出日時 2016-10-28 23:32:33
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 2,827 bytes
コンパイル時間 1,016 ms
コンパイル使用メモリ 111,584 KB
実行使用メモリ 28,928 KB
最終ジャッジ日時 2024-05-03 08:12:11
合計ジャッジ時間 3,560 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
18,688 KB
testcase_01 AC 27 ms
18,560 KB
testcase_02 AC 27 ms
18,432 KB
testcase_03 AC 27 ms
18,560 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 27 ms
18,432 KB
testcase_12 AC 27 ms
18,560 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 27 ms
18,688 KB
testcase_17 AC 28 ms
18,560 KB
testcase_18 WA -
testcase_19 AC 27 ms
18,688 KB
testcase_20 AC 27 ms
18,432 KB
testcase_21 AC 28 ms
18,560 KB
testcase_22 AC 28 ms
18,816 KB
testcase_23 AC 28 ms
18,688 KB
testcase_24 AC 28 ms
18,560 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 28 ms
18,560 KB
testcase_28 AC 28 ms
18,560 KB
testcase_29 AC 28 ms
18,688 KB
testcase_30 AC 29 ms
18,688 KB
testcase_31 AC 27 ms
18,560 KB
testcase_32 AC 27 ms
18,688 KB
testcase_33 WA -
testcase_34 AC 28 ms
18,688 KB
testcase_35 AC 27 ms
18,816 KB
testcase_36 AC 28 ms
18,688 KB
testcase_37 AC 27 ms
18,560 KB
testcase_38 AC 27 ms
18,560 KB
testcase_39 AC 28 ms
18,688 KB
testcase_40 AC 27 ms
18,560 KB
testcase_41 WA -
testcase_42 AC 28 ms
18,688 KB
testcase_43 AC 27 ms
18,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;




namespace contest
{

    class contest
    {


        static void Main(string[] args)
        {


            //int n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();




            //var n = int.Parse(Console.ReadLine());
            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();


            long n = long.Parse(Console.ReadLine());

            long score = 0;

            var ch = new int[n.ToString().Length];
            var memo = new int[10];
            for(int i =0; i<n.ToString().Length; i++)
            {
                int tmp = (char)(n.ToString()[i]-'0');
                memo[tmp]++;
                ch[i] = memo[tmp];
            }


            var list = new List<int>();
            var check = new bool[n.ToString().Length];
            for(int i = 9; i>=0; i--)
            {
                if ( memo[i]==0) continue;
                int tmp = 0;
                int target = i;
                if(target>0  )
                {
                    var mm = new int[3];
                    tmp += target;
                    var arr = n.ToString().ToArray();
                    int ind = Array.IndexOf(arr,(char)(target+'0'));
                    if (check[ind]) continue;
                    mm[2] = ind;
                    //check[ind] = true;
                    for (int j = ind; j < arr.Length; j++)
                    {
                        int cur = arr[j]-'0';
                        if (!check[j]&&target!=cur && memo[cur] > 1 && ch[j] < memo[cur] && tmp.ToString().Length == 1)
                        {
                            tmp *= 10;
                            tmp += cur;
                            mm[0] = j;
                            //check[j] = true;
                        }
                        else if (!check[j]&& target!=cur&& tmp%10==cur&&memo[cur] > 1 && ch[j] <= memo[cur] && tmp.ToString().Length == 2)
                        {
                            tmp *= 10;
                            tmp += cur;
                            mm[1] = j;
                            //check[j] = true;
                        }

                        if (tmp.ToString().Length == 3) break;
                    }
                    if(tmp.ToString().Length==3)
                    {
                        list.Add(tmp);
                        check[mm[0]] = true;
                        check[mm[1]] = true;
                        check[mm[2]] = true;
                    }
                }
            }



            Console.WriteLine(list.Sum());


           



            //Console.WriteLine(score);


            //Console.Read();


        }

    }


}
0