Drkcore

13 04 2010 java topcoder Tweet

SRM435DIV2_250

余計な変数多いな。

public class SkiFriction {

    public int bestPosition(String sF, String pF) {
        int sFl = sF.length();
        int pFl = pF.length();
        if(sFl >= pFl) return 0;
        int result = 0;
        for(int i=0;i<pFl-sFl;i++) {
            int lmax = 0;
            for(int j=0;j<sFl;j++){
                int k = sF.charAt(j) - '0'+ pF.charAt(i+j) - '0';
                if(k>lmax) lmax = k;
            }
            result += lmax;
        }
        return result;
    }    
}

数字の比較はMath.max使えばいいのか

About

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

Tag

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

Ad

© kzfm 2003-2021