結果

問題 No.481 1から10
ユーザー _mi_lin__mi_lin_
提出日時 2019-04-10 16:59:38
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 1,031 bytes
コンパイル時間 2,452 ms
コンパイル使用メモリ 99,696 KB
実行使用メモリ 22,876 KB
最終ジャッジ日時 2023-09-22 00:26:42
合計ジャッジ時間 4,026 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
20,764 KB
testcase_01 AC 58 ms
22,876 KB
testcase_02 AC 58 ms
18,628 KB
testcase_03 AC 57 ms
20,784 KB
testcase_04 AC 58 ms
22,740 KB
testcase_05 AC 57 ms
20,760 KB
testcase_06 AC 58 ms
20,692 KB
testcase_07 AC 58 ms
20,692 KB
testcase_08 AC 57 ms
20,880 KB
testcase_09 AC 59 ms
22,664 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.Linq;
using System.Text;
using System.Threading.Tasks;

namespace No481OnetoTen
{
    class Program
    {
        static void Main(string[] args)
        {
            //値の入力
            string[] number1 = Console.ReadLine().Split(' ');
            int[] number2 = new int[number1.Length];
            
            int ans = 0; //抜けてる数字をカウントするためのもの

            for (int i = 0; i < number1.Length; i++)
            {
               number2[i] = int.Parse(number1[i]);
               ans += 1;
                //10が漏れてる場合
                if (number2[8] == 9)
                {
                    Console.WriteLine(ans+1);
                    break;
                }
                //1~9のいずれかが漏れてる場合
                else if (number2[i] != i + 1)
                {
                    Console.WriteLine(ans);
                    break;
                }
            }
        }
    }
}
0