JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
public class solver{
public static void main(String args[]){
// solve it by making a seperate class for each step so that i can catch the expection
Scanner sc=new Scanner(System.in);
int t= sc.nextInt();
System.out.println(t);
//t*=t;
while(t>0){
int length= sc.nextInt();
int num= sc.nextInt();
int distanceCovered=0;
System.out.println(num );
while(num>0){
int d =sc.nextInt();
distanceCovered+= d;
// String direction= sc.next();
num--;
/** if(direction =="c"){
continue;
}else{
break;
}
*/
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run