AtCoder Beginner Contest 004

Submission #3978002

Source codeソースコード

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

class Program {
    static Scanner cin = new Scanner();

    static void Main(string[] args) {
        int N = cin.Int() % 30; //N == 30でカードの並びは'123456'に戻る
        string S = "123456";
        string ans = S.Substring(N / 5) + S.Substring(0, N / 5);
        N %= 5;
        for (int i = 1; i <= N; i++) {
            ans = ans.Substring(0, i - 1) + ans.Substring(i, 1) + ans.Substring(i - 1, 1) + ans.Substring(i + 1);
        }
        Console.WriteLine(ans);
        Console.ReadLine();
    }
}

class Scanner //標準入力
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int Int()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Int() + add;
        }
        return Array;
    }

    public long Long()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Long() + add;
        }
        return Array;
    }

    public double Double()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = Double() + add;
        }
        return Array;
    }
}

Submission

Task問題 C - 入れ替え
User nameユーザ名 みこし
Created time投稿日時
Language言語 C# (Mono 4.6.2.0)
Status状態 AC
Score得点 100
Source lengthソースコード長 2025 Byte
File nameファイル名
Exec time実行時間 22 ms
Memory usageメモリ使用量 13140 KB

Test case

Set

Set name Score得点 / Max score Cases
Subtask1 30 / 30 SubTask1/00_sample_00.txt,SubTask1/00_sample_01.txt,SubTask1/00_sample_02.txt,SubTask1/rand_19.txt,SubTask1/rand_2.txt,SubTask1/rand_25.txt,SubTask1/rand_27.txt,SubTask1/rand_33.txt,SubTask1/rand_35.txt,SubTask1/rand_4.txt,SubTask1/rand_44.txt,SubTask1/rand_48.txt,SubTask1/rand_8.txt
Subtask2 70 / 70 SubTask2/00_sample_03.txt,SubTask2/max_case.txt,SubTask2/rand_120009641.txt,SubTask2/rand_134230520.txt,SubTask2/rand_136939465.txt,SubTask2/rand_200732473.txt,SubTask2/rand_211796835.txt,SubTask2/rand_312330341.txt,SubTask2/rand_377341731.txt,SubTask2/rand_384611280.txt,SubTask2/rand_386098102.txt,SubTask2/rand_399010727.txt,SubTask2/rand_409627453.txt,SubTask2/rand_416537730.txt,SubTask2/rand_425486442.txt,SubTask2/rand_493135174.txt,SubTask2/rand_573105326.txt,SubTask2/rand_62794810.txt,SubTask2/rand_649471654.txt,SubTask2/rand_693017484.txt,SubTask2/rand_729197057.txt,SubTask2/rand_759630883.txt,SubTask2/rand_823752210.txt,SubTask2/rand_830399384.txt,SubTask2/rand_893242387.txt,SubTask2/rand_935005824.txt,SubTask2/rand_989703310.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
SubTask1/00_sample_00.txt AC 21 ms 11092 KB
SubTask1/00_sample_01.txt AC 21 ms 11092 KB
SubTask1/00_sample_02.txt AC 21 ms 11092 KB
SubTask1/rand_19.txt AC 22 ms 13140 KB
SubTask1/rand_2.txt AC 21 ms 9044 KB
SubTask1/rand_25.txt AC 21 ms 9044 KB
SubTask1/rand_27.txt AC 21 ms 11092 KB
SubTask1/rand_33.txt AC 21 ms 9044 KB
SubTask1/rand_35.txt AC 21 ms 9044 KB
SubTask1/rand_4.txt AC 21 ms 9044 KB
SubTask1/rand_44.txt AC 21 ms 11092 KB
SubTask1/rand_48.txt AC 21 ms 9044 KB
SubTask1/rand_8.txt AC 21 ms 9044 KB
SubTask2/00_sample_03.txt AC 21 ms 9172 KB
SubTask2/max_case.txt AC 21 ms 9044 KB
SubTask2/rand_120009641.txt AC 21 ms 9044 KB
SubTask2/rand_134230520.txt AC 21 ms 9044 KB
SubTask2/rand_136939465.txt AC 21 ms 11092 KB
SubTask2/rand_200732473.txt AC 21 ms 9044 KB
SubTask2/rand_211796835.txt AC 21 ms 9044 KB
SubTask2/rand_312330341.txt AC 21 ms 9044 KB
SubTask2/rand_377341731.txt AC 21 ms 9172 KB
SubTask2/rand_384611280.txt AC 21 ms 11092 KB
SubTask2/rand_386098102.txt AC 21 ms 9044 KB
SubTask2/rand_399010727.txt AC 21 ms 9044 KB
SubTask2/rand_409627453.txt AC 22 ms 11092 KB
SubTask2/rand_416537730.txt AC 21 ms 9044 KB
SubTask2/rand_425486442.txt AC 21 ms 9044 KB
SubTask2/rand_493135174.txt AC 21 ms 9044 KB
SubTask2/rand_573105326.txt AC 21 ms 11092 KB
SubTask2/rand_62794810.txt AC 21 ms 9044 KB
SubTask2/rand_649471654.txt AC 21 ms 9044 KB
SubTask2/rand_693017484.txt AC 21 ms 11092 KB
SubTask2/rand_729197057.txt AC 21 ms 11092 KB
SubTask2/rand_759630883.txt AC 21 ms 9044 KB
SubTask2/rand_823752210.txt AC 21 ms 9044 KB
SubTask2/rand_830399384.txt AC 21 ms 9044 KB
SubTask2/rand_893242387.txt AC 21 ms 11092 KB
SubTask2/rand_935005824.txt AC 21 ms 9044 KB
SubTask2/rand_989703310.txt AC 21 ms 11092 KB