We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
/*
* Complete the powersGame function below.
*/
static String powersGame(int n) {
if(n%8==0){
return "Second";
}
else{
return "First";
}
}
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) throws IOException {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
int t = Integer.parseInt(scanner.nextLine().trim());
for (int tItr = 0; tItr < t; tItr++) {
int n = Integer.parseInt(scanner.nextLine().trim());
String result = powersGame(n);
bufferedWriter.write(result);
bufferedWriter.newLine();
}
bufferedWriter.close();
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Powers Game
You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.math.; import java.text.; import java.util.; import java.util.regex.*;
public class Solution {
} else{ return "First"; } }
}