public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String str; while ((str = br.readLine()) != null) { String[] input = str.split(" "); int count = 0;// 字母的数量 int checkedCount = 0;// 选中的字母数量 int copyCount = 0;// 已复制的字母数量 for (String s : input) { int order = Integer.parseInt(s); // 用数字 12345代表 a,ctrl-c,ctrl-x,ctrl-v,ctrl-a五个键的输入 switch (order) { case 1: count++; break; case 2: copyCount = checkedCount; break; case 3: copyCount = checkedCount; count -= checkedCount; checkedCount = 0; break; case 4: if (copyCount != 0){ count -= checkedCount; checkedCount = 0; count += copyCount; } break; case 5: checkedCount = count; break; } } System.out.println(count); } }
点赞

相关推荐

牛客41406533...:回答他在课上学,一辈子待在学校的老教授用三十年前的祖传PPT一字一句的讲解,使用谭浩强红皮书作为教材在devc++里面敲出a+++++a的瞬间爆出114514个编译错误来学这样才显得专业
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务