How to read input with multiple lines in Java

后端 未结 10 1079
名媛妹妹
名媛妹妹 2020-12-05 02:48

Our professor is making us do some basic programming with Java, he gave a website and everything to register and submit our questions, for today I need to do this one exampl

10条回答
  •  自闭症患者
    2020-12-05 03:43

    I finally got it, submited it 13 times rejected for whatever reasons, 14th "the judge" accepted my answer, here it is :

    import java.io.BufferedInputStream;
    import java.util.Scanner;
    
    public class HashmatWarrior {
    
        public static void main(String args[]) {
            Scanner stdin = new Scanner(new BufferedInputStream(System.in));
            while (stdin.hasNext()) {
                System.out.println(Math.abs(stdin.nextLong() - stdin.nextLong()));
            }
        }
    }
    

提交回复
热议问题