i failed at something
This commit is contained in:
parent
32094afe55
commit
80146fc041
@ -1,12 +1,25 @@
|
|||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundExeption;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
public class FuelFinder{
|
public class FuelFinder{
|
||||||
public static void main(string[] vala){
|
public static void main(String[] vala){
|
||||||
int[] tVals ={12,14,1969,100756};
|
File file = new File("input.txt");
|
||||||
for (int a:tVals){
|
try {
|
||||||
System.out.println("FuelNeeded(a)");
|
Scanner sc = new Scanner(file);
|
||||||
|
while (sc.hasNextLine()) {
|
||||||
|
int i = sc.nextInt();
|
||||||
|
System.out.println(i);
|
||||||
|
}
|
||||||
|
sc.close();
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int FuelNeeded(int inp){
|
public static int FuelNeeded(int inp){
|
||||||
return ((inp/3)*2);
|
return ((inp/3)-2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user