Example #1
0
  /**
   * This method solves the given problem by {@link Mathe#getAlphabeticalValue(String) calculating
   * the alphabetical value} for every name in the {@link #names local memory}.
   *
   * @return the sum of all name scores
   * @see Mathe#getAlphabeticalValue(String)
   */
  @Override
  public String solve() {
    long res = 0;

    for (int i = 0; i < names.length; i++) {
      res += (i + 1) * Mathe.getAlphabeticalValue(names[i]);
    }

    return IO.l2s(res);
  }