Created
March 11, 2015 04:10
-
-
Save cc2011/854f180d1fe930a98e11 to your computer and use it in GitHub Desktop.
codechef OJUMPS : http://www.codechef.com/problems/OJUMPS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TLE:http://www.codechef.com/problems/OJUMPS | |
import java.io.PrintWriter; | |
import java.util.Arrays; | |
import java.util.Scanner; | |
import java.util.*; | |
import java.util.Collections; | |
import java.io.*; | |
import java.math.BigInteger; | |
public class Main{ | |
public static void main(String[] args) throws IOException | |
{ | |
BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); | |
long n = Long.parseLong(br.readLine()); | |
int[] jump = {1,2,3}; | |
int cnt = 0; | |
int i=0; | |
for(; i <= n;) { | |
if( i == n) { | |
System.out.println("yes"); | |
break; | |
} | |
cnt = cnt%3; | |
i += jump[cnt]; | |
cnt +=1; | |
} | |
if(i >n) | |
System.out.println("no"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment