Submission #371293


Source Code Expand

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String[] words = sc.nextLine().split(" ");
		ArrayList<String> ans = new ArrayList<>();
		int c = 0;
		for (int i = 0; i < words.length; ++i) {
			if (words[i].equals("not")) {
				++c;
			} else {
				if (c % 2 == 1) ans.add("not");
				ans.add(words[i]);
				c = 0;
			}
		}
		for (int i = 0; i < c; ++i) {
			ans.add("not");
		}
		for (int i = 0; i < ans.size() - 1; ++i) {
			System.out.print(ans.get(i) + " ");
		}
		System.out.println(ans.get(ans.size() - 1));
	}
}

Submission Info

Submission Time
Task A - 二重否定除去法則
User tomerun
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 692 Byte
Status AC
Exec Time 552 ms
Memory 26936 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 19
Set Name Test Cases
All scrambled_00.txt, scrambled_01.txt, scrambled_02.txt, scrambled_03.txt, scrambled_04.txt, scrambled_05.txt, scrambled_06.txt, scrambled_07.txt, scrambled_08.txt, scrambled_09.txt, scrambled_10.txt, scrambled_11.txt, scrambled_12.txt, scrambled_13.txt, scrambled_14.txt, scrambled_15.txt, scrambled_16.txt, scrambled_17.txt, scrambled_18.txt
Case Name Status Exec Time Memory
scrambled_00.txt AC 430 ms 23880 KB
scrambled_01.txt AC 425 ms 23940 KB
scrambled_02.txt AC 420 ms 23916 KB
scrambled_03.txt AC 429 ms 23928 KB
scrambled_04.txt AC 434 ms 23948 KB
scrambled_05.txt AC 493 ms 26096 KB
scrambled_06.txt AC 531 ms 26556 KB
scrambled_07.txt AC 490 ms 26212 KB
scrambled_08.txt AC 492 ms 26468 KB
scrambled_09.txt AC 479 ms 26020 KB
scrambled_10.txt AC 497 ms 26484 KB
scrambled_11.txt AC 493 ms 26348 KB
scrambled_12.txt AC 526 ms 26936 KB
scrambled_13.txt AC 552 ms 26804 KB
scrambled_14.txt AC 513 ms 26776 KB
scrambled_15.txt AC 499 ms 26292 KB
scrambled_16.txt AC 505 ms 26736 KB
scrambled_17.txt AC 508 ms 26908 KB
scrambled_18.txt AC 506 ms 26920 KB