AtCoder Beginner Contest 019

Submission #347162

Source codeソースコード

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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    void calc()
    {
        Scanner cin = new Scanner();
        int N = cin.nextInt();
        int[] a = new int[N];

        for (int i = 0; i < N; i++)
        {
            a[i] = cin.nextInt();
            while (a[i] % 2 == 0) a[i] /= 2;
        }

        Array.Sort(a);
        int pre = -1;
        int ret = 0;
        foreach (var item in a)
        {
            if (item == pre) continue;
            ret++;
            pre = item;
        }
        Console.WriteLine(ret);
    }

}




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);
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

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

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

}


class XRand
{
    uint x, y, z, w;


    public XRand()
    {
        init();
    }

    public XRand(uint s)
    {
        init();
        init_xor128(s);
    }

    void init()
    {
        x = 314159265; y = 358979323; z = 846264338; w = 327950288;

    }

    public void init_xor128(uint s)
    {
        z ^= s;
        z ^= z >> 21; z ^= z << 35; z ^= z >> 4;
        z *= 736338717;
    }

    uint next()
    {
        uint t = x ^ x << 11; x = y; y = z; z = w; return w = w ^ w >> 19 ^ t ^ t >> 8;
    }

    public long nextLong(long m)
    {
        return (long)((((ulong)next() << 32) + next()) % (ulong)m);
    }

    public int nextInt(int m)
    {
        return (int)(next() % m);
    }

    public long nextLong(long min, long max)
    {
        return min + nextLong(max - min + 1);
    }

    public int nextInt(int min, int max)
    {
        return min + nextInt(max - min + 1);
    }

    public int nextIntP(int a)
    {
        return (int)Math.Pow(a, nextDouble());
    }

    public int nextIntP(int min, int max)
    {
        int diff = max - min;
        return min + nextIntP(diff + 2) - 1;
    }

    public long nextLongP(long a)
    {
        return (long)Math.Pow(a, nextDouble());
    }

    public long nextLongP(long min, long max)
    {
        long diff = max - min;
        return min + nextLongP(diff + 2) - 1;
    }


    public double nextDouble()
    {
        return (double)next() / uint.MaxValue;
    }

    public double nextDoubleP(double a)
    {
        return Math.Pow(a, nextDouble());
    }
}

Submission

Task問題 C - 高橋くんと魔法の箱
User nameユーザ名 chokudai
Created time投稿日時
Language言語 C# (Mono 2.10.8.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 3118 Byte
File nameファイル名
Exec time実行時間 322 ms
Memory usageメモリ使用量 15960 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0_0.txt,subtask0_1.txt,subtask0_2.txt
Subtask1 20 / 20 subtask1_0.txt,subtask1_1.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_2.txt,subtask1_3.txt,subtask1_4.txt,subtask1_5.txt,subtask1_6.txt,subtask1_7.txt,subtask1_8.txt,subtask1_9.txt,subtask0_0.txt,subtask0_1.txt,subtask0_2.txt
Subtask2 30 / 30 subtask2_0.txt,subtask2_1.txt,subtask2_2.txt,subtask2_3.txt,subtask2_4.txt,subtask2_5.txt,subtask2_6.txt,subtask2_7.txt,subtask2_8.txt,subtask2_9.txt,subtask0_0.txt,subtask0_1.txt,subtask0_2.txt
All 50 / 50 subtask0_0.txt,subtask0_1.txt,subtask0_2.txt,subtask1_0.txt,subtask1_1.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_2.txt,subtask1_3.txt,subtask1_4.txt,subtask1_5.txt,subtask1_6.txt,subtask1_7.txt,subtask1_8.txt,subtask1_9.txt,subtask2_0.txt,subtask2_1.txt,subtask2_2.txt,subtask2_3.txt,subtask2_4.txt,subtask2_5.txt,subtask2_6.txt,subtask2_7.txt,subtask2_8.txt,subtask2_9.txt,subtask3_0.txt,subtask3_1.txt,subtask3_2.txt,subtask3_3.txt,subtask3_4.txt,subtask3_5.txt,subtask3_6.txt,subtask3_7.txt,subtask3_8.txt,subtask3_9.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0_0.txt AC 143 ms 7776 KB
subtask0_1.txt AC 144 ms 7884 KB
subtask0_2.txt AC 144 ms 7772 KB
subtask1_0.txt AC 150 ms 8008 KB
subtask1_1.txt AC 148 ms 8152 KB
subtask1_10.txt AC 149 ms 7968 KB
subtask1_11.txt AC 148 ms 8144 KB
subtask1_12.txt AC 148 ms 8152 KB
subtask1_13.txt AC 151 ms 8072 KB
subtask1_14.txt AC 144 ms 8152 KB
subtask1_15.txt AC 147 ms 8144 KB
subtask1_16.txt AC 148 ms 8176 KB
subtask1_17.txt AC 152 ms 8084 KB
subtask1_18.txt AC 151 ms 8068 KB
subtask1_19.txt AC 150 ms 8148 KB
subtask1_2.txt AC 149 ms 8148 KB
subtask1_3.txt AC 147 ms 8140 KB
subtask1_4.txt AC 147 ms 8152 KB
subtask1_5.txt AC 153 ms 8156 KB
subtask1_6.txt AC 153 ms 8208 KB
subtask1_7.txt AC 152 ms 8072 KB
subtask1_8.txt AC 150 ms 8080 KB
subtask1_9.txt AC 150 ms 8068 KB
subtask2_0.txt AC 255 ms 15068 KB
subtask2_1.txt AC 270 ms 15076 KB
subtask2_2.txt AC 235 ms 15072 KB
subtask2_3.txt AC 236 ms 15092 KB
subtask2_4.txt AC 235 ms 15064 KB
subtask2_5.txt AC 243 ms 15068 KB
subtask2_6.txt AC 265 ms 15104 KB
subtask2_7.txt AC 231 ms 15056 KB
subtask2_8.txt AC 232 ms 15076 KB
subtask2_9.txt AC 229 ms 15056 KB
subtask3_0.txt AC 208 ms 15060 KB
subtask3_1.txt AC 246 ms 15840 KB
subtask3_2.txt AC 246 ms 15836 KB
subtask3_3.txt AC 322 ms 15952 KB
subtask3_4.txt AC 245 ms 15960 KB
subtask3_5.txt AC 244 ms 15948 KB
subtask3_6.txt AC 246 ms 15840 KB
subtask3_7.txt AC 245 ms 15824 KB
subtask3_8.txt AC 246 ms 15824 KB
subtask3_9.txt AC 246 ms 15940 KB