标签:for ati 规模 href 超时 indexof 方案 技术 准备
目录
运行结果评分70分,原因:运行超时。代码仅供参考~
具体代码如下:
import java.util.Scanner; import java.util.Vector; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); Vector<Integer> list = new Vector<Integer>(); for(int i = 0;i < n;i++) list.add(in.nextInt()); for(int i = 0;i < m;i++) { String operation = in.next(); if(operation.equals("ADD")) { int P = in.nextInt(); int Q = in.nextInt(); int j = list.indexOf(P); list.add(j, Q); } else if(operation.equals("DEL")) { int P = in.nextInt(); int j = list.indexOf(P); list.remove(j); } } System.out.println(list.size()); for(int i = 0, len = list.size();i < len;i++) System.out.print(list.get(i)+" "); } }
算法笔记_098:蓝桥杯练习 算法提高 盾神与条状项链(Java)
标签:for ati 规模 href 超时 indexof 方案 技术 准备
原文地址:http://www.cnblogs.com/liuzhen1995/p/6580963.html