http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=20485
這題把字串放入字元陣列中再一一的相加
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n=Integer.parseInt(scn.nextLine());
while(n--!=0){
char arr[]=scn.nextLine().toCharArray();
int tot=0;
for(int i=0;i<arr.length;i++){
tot+=arr[i];
}
System.out.println(tot);
}
}
/*
題目:[C_MM275-易] 字串之編碼數值總和
作者:1010
時間:西元 2016 年 8 月 */
}