drkcore

2010/04/10 18:09:00

SRM460DIV2_250

java勉強中。

import java.util.ArrayList;
import java.util.List;

public class TheQuestionsAndAnswersDivTwo {

    public int find(String[] q) {
        List qlist = new ArrayList();
        int ans = 0;
        for (int i = 0; i < q.length; ++i)
            if (!qlist.contains(q[i]))
                qlist.add(q[i]);

        ans = (int) Math.pow(2, qlist.size());
        return ans;
    }

}

Set使えばいいのね。

Comments