package a360; import java.util.*; /** * @author Rorke * @date 2020/8/22 19:44 */ public class Q2 { public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(), m = input.nextInt(); Deque<Integer> odd = new LinkedList<>(); Deque<Integer> even = new LinkedList<>(); for (int i = 0; i < n; i++) { if (i % 2 == 0) { odd.offer(i + 1); } else { even.offer(i + 1); } } List<Integer> operates = new ArrayList<>(); for (int i = 0; i < m; i++) { operates.add(input.nextInt()); } for (int o : operates) { if (o == 1) { odd.offer(odd.poll()); } Deque<Integer> tmp = odd; odd = even; even = tmp; } for (int i = 0; i < n/2; i++) { System.out.print(odd.poll()+" "+even.poll()+" "); } if (!odd.isEmpty()){ System.out.println(odd.poll()); } } }
心态崩了。。。。
还有我记得我投的是java岗,选择题整那么多C艹的直接白给了。
全部评论
(3) 回帖