For the easy problem 11799 - Horror Dash I'm getting runtime error!! Interestingly I'm using gcc/g++ compiler in fedora. My compiler version is 4.4.4 20100503. I have no problem at runtime but I'm getting runtime error. How!!! I tested my code in dev cpp in windows platform. Still no runtime problem was there. Is there any idea what is going wrong? My code is here.
1 . However, to keep the audience on the edge of their seats, the clown must not run too fast either .......
2. Given the speed of every scary creature, you are to find out the minimum speed that the clown must maintain so as not to get caught even if they keep on running forever ..........
3. You can assume that they are always running in the same direction on the track........
from this three line i thought of finding the max from the the number of students acting as scary creatures(that is from the given N ) .... so find that and output dats it ....... btw what was ur thought ???? .....
import java.util.Scanner;
/**
* 11799 - Horror Dash
*/
class HorrorDash {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
int c = 1;
while(t-- > 0) {
int n = scanner.nextInt();
int max = 1;
for (int i = 0; i < n; i++) {
int value = scanner.nextInt();
if (value > max) {
max = value;
}
}
System.out.printf("Case %d: %d%n", c++, max);
}
scanner.close();
}
}
import java.util.Scanner;
/**
* 11799 - Horror Dash
*/
class HorrorDash {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int t = scanner.nextInt();
int c = 1;
while(t-- > 0) {
int n = scanner.nextInt();
int max = 1;
for (int i = 0; i < n; i++) {
int value = scanner.nextInt();
if (value > max) {
max = value;
}
}
System.out.printf("Case %d: %d%n", c++, max);
}
scanner.close();
}
}
Thanks.
Nvm. I found the issue. I must use Main for all the class name as directed in Submission Specification.