|
|
back to boardDiscussion of Problem 1607. Taxiwhat's a problem? Posted by badion 18 Mar 2013 15:13 import java.util.*; public class Taxi { public static void main(String[] args) {
int a, b, c, d;
Scanner rc = new Scanner(System.in); System.out.println("Введите стартовую сумму клиента: "); a = rc.nextInt(); System.out.println("Введите стартовую сумму водителя: "); c = rc.nextInt(); System.out.println("Введите сумму, на которую клиент повышает: "); b = rc.nextInt(); System.out.println("Введите сумму, на которую водитель понижает: "); d = rc.nextInt(); while (a < c){
a+=b; c-=d; }
System.out.println("Сумма, на которой они сошлись: "+a);
}
} у меня всё нормально работает, а ихний компилятор бракует... что не правильно? Edited by author 18.03.2013 15:14 Edited by author 18.03.2013 15:14 Re: what's a problem? Posted by badion 18 Mar 2013 22:00 actually i have read this topic yesterday, but i still don't understand, what i do wrong... Re: what's a problem? System.out.println("Введите стартовую сумму клиента: "); Such lines of code are extra, Timus checker thinks that it is an answer for task, and check it - but it is wrong :) So, don't put such lines in your programs. Re: what's a problem? Posted by badion 18 Mar 2013 23:40 ok.. look. I erased all "extra lines". but this code does not compiling too... sorry for my silly questions, but i'm a newbie on this site and i need to understand what i did wrong.. import java.util.*; public class car { public static void main(String[] args) {
Scanner rc = new Scanner(System.in);
int a = rc.nextInt(); int c = rc.nextInt(); int b = rc.nextInt(); int d = rc.nextInt(); while (a < c){
a+=b; c-=d; } System.out.print(a);
} } |
|
|