Submission #371315


Source Code Expand

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner in = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		String s = in.nextLine();
		String ss[] = s.split(" ");
		String not = "not";
		for (int i = 0; i < ss.length; i++) {
			if (!not.equals(ss[i])) {
				while (s.indexOf(not + " " + not + " " + ss[i]) != -1) {
					s = s.replaceAll(not + " " + not + " " + ss[i], ss[i]);
				}
			}
		}
		out.println(s);
		out.flush();
	}

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		public InputReader(String input) {
			this.stream = new ByteArrayInputStream(input.getBytes());
		}

		public int next() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = next();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = next();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public long nextLong() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = next();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = next();
			} while (!isSpaceChar(c));
			return res * sgn;
		}

		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}

Submission Info

Submission Time
Task A - 二重否定除去法則
User hoshi524
Language Java (OpenJDK 1.7.0)
Score 100
Code Size 2465 Byte
Status AC
Exec Time 535 ms
Memory 33872 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 379 ms 24160 KB
scrambled_01.txt AC 373 ms 23992 KB
scrambled_02.txt AC 361 ms 23948 KB
scrambled_03.txt AC 365 ms 24032 KB
scrambled_04.txt AC 368 ms 23952 KB
scrambled_05.txt AC 528 ms 33680 KB
scrambled_06.txt AC 441 ms 26460 KB
scrambled_07.txt AC 533 ms 33872 KB
scrambled_08.txt AC 535 ms 33864 KB
scrambled_09.txt AC 433 ms 26288 KB
scrambled_10.txt AC 457 ms 26548 KB
scrambled_11.txt AC 469 ms 26660 KB
scrambled_12.txt AC 453 ms 26832 KB
scrambled_13.txt AC 460 ms 26584 KB
scrambled_14.txt AC 469 ms 26992 KB
scrambled_15.txt AC 478 ms 27004 KB
scrambled_16.txt AC 481 ms 26716 KB
scrambled_17.txt AC 475 ms 26648 KB
scrambled_18.txt AC 469 ms 27224 KB