11070 - The Good Old Times

Moderator: Board moderators

11070 - The Good Old Times

Last edited by Ashkankhan on Sun Aug 13, 2006 6:06 am, edited 2 times in total.
Ashkankhan
New poster

Posts: 12
Joined: Wed Oct 13, 2004 10:14 am
Location: Teh

Re: 11079 : The Good Old Times

input:
100
-10+2+2
Correct output
100.000
-6.000
0.000
4.000

lord_burgos
New poster

Posts: 43
Joined: Mon Oct 13, 2003 4:54 pm
Location: Mexico

during the contest i've got several CE on this problem , and when i checked my mail, it was written No Such a File or Directory but after contest i submit it without any changes and i got AC , can somebody tell me why this happens? because it was very awful during the contest
In being unlucky I have the record.

arsalan_mousavian
Experienced poster

Posts: 111
Joined: Mon Jan 09, 2006 6:19 pm
Location: Tehran, Iran

well if any one gets WA then u may try with these:

Code: Select all
`--9-1-1+9/3---9-9--+-9`

i was having trouble with multiple unary oparators
Self judging is the best judging!
shanto86
Experienced poster

Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

Oops

My output for this:
2*-0.5+-0.5*3+-15.5
1/2/2
-3.0
3
4.0+3.0/5.0
1*2*3+1+1*2+1*2*3*4
--9
-1-1+9/3
---9
-9--+-9
100
-10+2+2

is

-18.000
0.250
-3.000
3.000
4.600
33.000
9.000
1.000
-9.000
-18.000
100.000
-6.000

it this correct?

Please some one can help me?
ivan.cu
New poster

Posts: 21
Joined: Sun Mar 19, 2006 7:50 pm
Location: Cuba

Re: Oops

ivan.cu wrote:it this correct?

Yes, it is.

Martin Macko
A great helper

Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Re: 11079 : The Good Old Times

Ashkankhan, could you, please, change the subject of this topic, so it would contain the number of this problem (i.e., 11070) instead of the number 11079? I think many people would appreciate it.

Martin Macko
A great helper

Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

hmm

"No input file" is a bug of the judge. So try submitting again and again if you get this error.
shahriar_manzoor

Posts: 400
Joined: Sat Jan 12, 2002 2:00 am

talking about the error, yesterday i faced a new thing, judge accepted code till 5:00:59. why so? i got last ac at 5:00:02. so today i checked the status page and i c that judge evaluated till 5:00:53

http://online-judge.uva.es/contest/status.php?h=2128&r=60
Self judging is the best judging!
shanto86
Experienced poster

Posts: 160
Joined: Wed Jul 30, 2003 8:10 pm

i guess most of the input given here don't appear in judge's input, i got ac withouth considering such cases(in fact, i consider unary operators will appear only at th beginning of a line, after all expresions like 5*-2 doesn't make sense)
trulo17
Learning poster

Posts: 62
Joined: Mon Jan 24, 2005 6:12 am
Location: Lima,Peru

Help!!

I don't understand why i have a WA, some one can give me an email for send my WA code in Java?
ivan.cu
New poster

Posts: 21
Joined: Sun Mar 19, 2006 7:50 pm
Location: Cuba

trulo17 wrote:i guess most of the input given here don't appear in judge's input, i got ac withouth considering such cases(in fact, i consider unary operators will appear only at th beginning of a line, after all expresions like 5*-2 doesn't make sense)

How does the expresion '5*-2' make no sense? I don't understand.

Martin Macko
A great helper

Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

you're right martin, i was wrong saying that, anyway those cases dont appear in the input(ohterwise i would get wrong answer)
trulo17
Learning poster

Posts: 62
Joined: Mon Jan 24, 2005 6:12 am
Location: Lima,Peru

Here is my WA Code

Code: Select all
`//import java.io.FileInputStream;//import java.io.FileNotFoundException;class Main {   public static void main(String[] args) {//      try {//         System.setIn(new FileInputStream("input.txt"));//      } catch (FileNotFoundException e1) {//      }      boolean end = false;      String n = "";      try {         n = Consola.readLine();      } catch (Exception e) {         end = true;      }      Main m = new Main();      while (!end) {         System.out.println(m.doIt(n));         try {            n = Consola.readLine();         } catch (Exception e) {            end = true;         }      }   }   private String doIt(String c) {      Expr t = new Expr(c);      return format("" + t.eval());   }   private String format(String a) {      String r = "";      int i = 0, l = a.length();      boolean decimal = false;      while (i < l) {         r += a.charAt(i);         if (a.charAt(i) == '.' || a.charAt(i) == ',') {                        decimal = true;            if (i + 1 < l)               r += a.charAt(i + 1);            else               r += "0";            if (i + 2 < l)               r += a.charAt(i + 2);            else               r += "0";            if (i + 3 < l)               r += a.charAt(i + 3);            else               r += "0";            break;         }         i++;      }      if (!decimal)         r += ".000";      return r;   }}class Expr {   char o;   double v;   Expr r, d;   public double valueOf(String n) {      int l = n.length();      int i = 0;      int a = 0;      int d = 0;      int cd = 1;      boolean dc = false;      while (i < l) {         if (n.charAt(i) == '.') {            dc = true;         } else {            if (dc) {               a = a * 10 + (n.charAt(i) - '0');               cd *= 10;            } else {               d = d * 10 + (n.charAt(i) - '0');            }         }         i++;      }      if (dc)         return 1.0d * d + 1.0 * a / cd;      else         return 1.0d * d;   }   public Expr(String c) {         int i = c.length() - 1;         while (i >= 0 && c.charAt(i) != '+' && c.charAt(i) != '-') {            i--;            do {               i--;            } while (i >= 0                  && (c.charAt(i) == '+' || c.charAt(i) == '-'                        || c.charAt(i) == '*' || c.charAt(i) == '/'));            i++;         }         if (i > 0 && (c.charAt(i) == '+' || c.charAt(i) == '-')) {            o = c.charAt(i);            r = new Expr(c.substring(0, i));            d = new Expr(c.substring(i + 1));         } else {            i = c.length() - 1;            while (i >= 0 && c.charAt(i) != '*' && c.charAt(i) != '/')               i--;            if (i >= 0 && (c.charAt(i) == '*' || c.charAt(i) == '/')) {               o = c.charAt(i);               r = new Expr(c.substring(0, i));               d = new Expr(c.substring(i + 1));            } else {               o = 'v';               char in = c.charAt(0);               int p = 1;               while (in == '-' || in == '+') {                  c = c.substring(1);                  p *= in == '-' ? -1 : 1;                  in = c.charAt(0);               }               v = p * Double.valueOf(c).doubleValue();            }         }   }   public double eval() {      switch (o) {      case 'v':         return v;      case '+':{         double aa = r.eval();         double bb = d.eval();         return aa + bb;         }      case '-':         return r.eval() - d.eval();      case '*':         return r.eval() * d.eval();      case '/':         return r.eval() / d.eval();      }      return -1;   }}class Consola {   private static int maxLongitud = 256;   private static byte[] lin = new byte[maxLongitud];   public static String readLine() throws Exception {      int lg = 0, car = -1;      try {         while (true) {            car = System.in.read();            if ((car < 0 && lg == 0)                  || ((car < 0) || (car == '\r') || (car == '\n'))                  && lg != 0) {               break;            } else if (!((car < 0) || (car == '\r') || (car == '\n'))) {               lin[lg++] = (byte) car;            }         }      } catch (Exception e) {         throw (null);      }      if ((car < 0) && (lg == 0))         throw (null); // eof      return (new String(lin, 0, lg));   }   public static String readWord() throws Exception {      int lg = 0, car = -1;      try {         while (true) {            car = System.in.read();            if ((car < 0 && lg == 0) || (car <= 32 && lg != 0)) {               break;            } else if (!(car <= 32)) {               lin[lg++] = (byte) car;            }         }      } catch (Exception e) {         throw null;      }      if ((car < 0) && (lg == 0)) {         throw null; // eof      }      lin[lg] = '\0';      return (new String(lin, 0, lg));   }   public static int readInt() throws Exception {      String read = readWord();      if (read.equals(null)) {         throw null;      }      return Integer.parseInt(read);   }}`
ivan.cu
New poster

Posts: 21
Joined: Sun Mar 19, 2006 7:50 pm
Location: Cuba

Re: Here is my WA Code

ivan.cu wrote:
Code: Select all
`//import java.io.FileInputStream;//import java.io.FileNotFoundException;...`

Try:
Code: Select all
`-10*0`

The correct output:
Code: Select all
`0.000`

Code: Select all
`-0.000`

Martin Macko
A great helper

Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Next