题解 | #坐标移动#
坐标移动
http://www.nowcoder.com/practice/119bcca3befb405fbe58abe9c532eb29
定义一个初始坐标 用整型数组int[] in={0,0} 花括号哦!
使用split 方法拆分接收的字符串 成 字符串数组String[] str= s.split(String)
处理每一个元素其中第一位表示移动方向,后面一位或两位表示位移量(用于整数运算),使用substring() 方法获取
重点处理字符串中每个字符, 使用String.charAt, 同时涉及字符串转整型(用Integer.parseInt(String s))
使用算数表达式 int num+=ss;等实现位移