問題:http://acm.pku.edu.cn/JudgeOnline/problem?id=3094
順位:http://acm.pku.edu.cn/JudgeOnline/problemstatus?problem_id=3094&orderby=clen&language=2
提出コード(201B)
import java.util.*;class Main{static{String x;for(Scanner s=new Scanner(System.in);!(x=s.nextLine()).equals("#");){int r=0,i=0;for(char y:x.toCharArray())r+=++i*(y==32?0:y-64);System.out.println(r);}}}
整形コード
class Main { static { String x; for (Scanner s = new Scanner(System.in); !(x = s.nextLine()) .equals("#");) { int r = 0, i = 0; for (char y : x.toCharArray()) r += ++i * (y == 32 ? 0 : y - 64); System.out.println(r); } } }