This page is still under construction.

Parts of this page are still being built. What you see may change.

You Be the Judge!

Time limit1sMemory limit1024 MB

Summary
Given up to 1000 lines of ASCII text, decide whether it contains exactly three whitespace-separated base-ten integers forming a valid Goldbach triple.
Level

Medium4 of 10

Topics
String, Implementation, Number theory, Math
Solved
No attempts yet

Problem

Congratulations! You are now the judge of a programming contest! You've been put in charge of a problem, and since your problem may not have unique correct output, you've got to write an output checker for it.

Your problem is called "Good as Goldbach", and it's based on the Goldbach Conjecture (that any positive even integer greater than 3 can be expressed as the sum of two primes). A solving program's output should have three numbers separated by whitespace: First, a positive even integer greater than 3 and less than or equal to 10^9, and then two (positive) prime numbers which sum to the even number.

You must write a checker for this problem. Your checker should take the output of a contestant's program, and determine whether or not it could possibly be correct. That is, determine if the contestant's output consists only of three tokens separated by whitespace, the first of which is a positive even integer greater than 3 and less than or equal to 10^9, and the next two are positive prime integers which sum to the first. The integers should be in base ten, with no signs or leading zeros. Any amount of white space anywhere except within an integer, including blank lines, is OK. Any other output, extra characters, missing numbers, etc. should be considered incorrect.

Input

The input will consist of from 0 to 1,000 lines. Each line consists of from 0 to 100 printable ASCII characters (with codes 32 through 126), or tabs.

Output

Output a single integer, which is 1 if the input could possibly be a correct output for the "Good as Goldbach" problem, or 0 if the input could not possibly be a correct output for the "Good as Goldbach" problem.

Examples5

  1. Example 1

    Input
    10 3 7
    
    Expected output
    1
    
  2. Example 2

    Input
    10   3   7
    
    Expected output
    1
    
  3. Example 3

    Input
    314
    159 265
    358
    
    Expected output
    0
    
  4. Example 4

    Input
    22 19 3
    
    Expected output
    1
    
  5. Example 5

    Input
    
       60
      
      29
      
          31
    	  
    	  
    	  
    	  
    
    Expected output
    1