Drkcore

10 04 2010 java topcoder Tweet

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使えばいいのね。

  • コレクションフレームワーク
  • javaの道

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021