ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1000. A+B Problem

Java
Posted by Arheus 28 Aug 2014 01:04
What is wrong?
import java.util.*;

public class Main {
    public static void main(String[] args){
        int a,b = 0;

        Scanner in = new Scanner(System.in);

        System.out.println("First num");
        a = in.nextInt();
        if(a==1){
        System.out.println("Second num");
        b = in.nextInt();}
        if(b==5){
        System.out.println(a+b);
        }
    }
}
Re: Java
Posted by Vlad 29 Aug 2014 23:25
You should not write any other message than the expected output.
How should the compiler know that writing "First num" and "Second num" isn't part of the problem result?



Edited by author 29.08.2014 23:25
Re: Java
Posted by wyq358171691@sina.com 11 Sep 2014 09:00
big int will be wrong
Re: Java
Posted by Danila 1 Oct 2014 18:42
What is the problem

import java.util.Scanner;
public class Summa {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
Scanner scan=new Scanner( System.in);
System.out.println("Введите значение a");
int a;
a=scan.nextInt();
System.out.println("Введите значение b");
int b;
b=scan.nextInt();

System.out.println(" a + b = " + (a + b));

    }

}
Re: Java
Posted by ACkf 20 Dec 2014 10:54
You should not write any other message than the expected output.
Re: Java
Posted by Sazid Hasan 14 Jan 2016 00:05
what is the problem?



package Acm;

import java.util.Scanner;

public class Num {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        Scanner numscanner = new Scanner(System.in);

        int a = numscanner.nextInt();
        int b = numscanner.nextInt();
        System.out.println(a + b);
    }
}