You are viewing a single comment's thread. Return to all comments →
JAVA SOLUTION
import java.util.Scanner; class ConnectingTowns { public static void main(String[] args) { short testCase, routes; byte towns; int possibleRoutes; Scanner sc = new Scanner(System.in); testCase = sc.nextShort(); while(testCase-- > 0) { towns = sc.nextByte(); possibleRoutes = 1; for(byte i = 1; i < towns; i++) { routes = sc.nextShort(); possibleRoutes *= routes; possibleRoutes %= 1234567; } System.out.println(possibleRoutes); } } }
Seems like cookies are disabled on this browser, please enable them to open this website
Connecting Towns
You are viewing a single comment's thread. Return to all comments →
JAVA SOLUTION