| Show all threads Hide all threads Show all messages Hide all messages |
| What's wrong? (pascal) | Jumbo | 1074. Very Short Problem | 22 Mar 2011 16:44 | 1 |
var x:real;s,s1:string; c,n:integer; begin repeat readln(s); val(s,x,c); if s='#' then halt; readln(s1); if c=0 then begin val(s1,n,c);writeln(x:0:n) end else writeln('Not a floating point number'); until s1='#'; end. Edited by author 22.03.2011 16:49 Edited by author 22.03.2011 16:49 |
| it accepted! | Jumbo | 1149. Sinus Dances | 22 Mar 2011 01:45 | 1 |
var n1,n,i:integer; a:array[1..200] of string; s,s1:string; procedure zap(x:integer); var i,k:integer; s,s1,s2,s3:string; begin a[1]:='sin(1)'; for i:=2 to x do begin s:=a[i-1]; for k:=length(s) downto 1 do if (s[k]>='0') and (s[k]<='9') then begin str(i-1,s3); delete(s,k+1-length(s3),length(s3));break end; if i mod 2=0 then begin str(i-1,s1); str(i,s2); s1:=s1+'-'+'sin'+'('+s2+')'; insert(s1,s,k+1-length(s3)); end else begin str(i-1,s1); str(i,s2); s1:=s1+'+'+'sin'+'('+s2+')'; insert(s1,s,k+1-length(s3)); end; a[i]:=s; end; end; begin read(n); zap(n); n1:=n-1; str(n,s1); s:='('+a[1]+'+'+s1+')'; for i:=2 to n-1 do begin str(n1,s1); s:='('+s+a[i]+'+'+s1+')'; n1:=n1-1; end; s:=s+a[n]+'+'+'1'; if n=1 then writeln(a[1]+'+'+'1') else writeln(s); end. |
| why wa 24? i used nested ternary search. what's the idea to solve the problem? | muhammad | 1828. Approximation by a Progression | 21 Mar 2011 18:21 | 3 |
i used nested ternary search on a and d but wa ( 24 when eps=1e-7 && 11 when eps<1e-7) i figured the function should be like that- f(a,d)=c1a^2+c2a+c3ad+c4d^2+c5d+c6 where c1=n && c4=n*(n-1)*(2*n-1)/6.0 here for n>1 the coefficient of a^2 and d^2 is always positive. so there should be only one(since quadratic) and low peak. so i thought ternary search would do. but why diff wa on diff value of eps. again, i found (by checking for tle) that there are high peaks as well. how can it be? perhaps, i am wrong right on the idea itself. please, guys help me find my bug. and, please tell me at least the method of solving. is it ternary search or some direct math formula or something else i am missing. if ternary search please tell me whether there is indeed high peaks and how did u deal with them... thanks in advance. Edited by author 21.03.2011 17:01 There is closed-form solution to the problem. Read some basic econometrics textbooks, "simple linear regression" section therein. thanks very much got ac. so simple :) |
| Tell me test #2 Please | Jumbo | 1020. Rope | 21 Mar 2011 02:17 | 1 |
Edited by author 21.03.2011 02:18 Edited by author 21.03.2011 02:18 |
| What test #19?? | Nikita Sivukhin | 1821. Biathlon | 20 Mar 2011 22:44 | 1 |
|
| Fix the statement's text, please. | olpetOdessaONU [1 2/3] | 1827. Indigenous Wars | 20 Mar 2011 18:23 | 2 |
Powers of all the numbers in statement was disappeared. Restore them, please. My browser is Opera 11.01. Yes, this is a known bug and it appears in some other problems with sub/superscripts. Everything is ok in english statements btw. |
| why its gvng wrong answer? | tanu | 1001. Reverse Root | 20 Mar 2011 15:44 | 2 |
#include<iostream> #include<vector> #include<cmath> using namespace std; int main(){ double x; int i=0; double a[100]; while(cin>>x) { a[i]=(sqrt(x)); i++; } for(int j=i-1;j>=0;j--)printf("%.4f\n",a[i]); return 0; } 1) Change double to long double. 10^18 is much more, than double type can contain. 2) The size of your array may be greater than 100. |
| WTF? | Dmitry Zheschinsky | 1820. Ural Steaks | 20 Mar 2011 13:47 | 3 |
WTF? Dmitry Zheschinsky 19 Mar 2011 15:12 cant understand what can be in 14 test?? i've succesfully submited my code before and i know it really works Re: WTF? daftcoder [Yaroslavl SU] 19 Mar 2011 17:12 Where did you succesfully submited your code before? Re: WTF? Dmitry Zheschinsky 20 Mar 2011 13:47 |
| what should b the output? | AshimaBhatia | 1826. Minefield | 20 Mar 2011 00:57 | 6 |
what should be the output for following input? n=5 1 2 5 10 11 i'm too geting the same output in my machine but the server is saying wrong answer by test4. why is this so? |
| Accepted wrong code? | lilica | 1820. Ural Steaks | 20 Mar 2011 00:54 | 1 |
I submitted this code, and it was accepted, though if n=2 and k=5, the answer is 1, which is impossible import java.io.*; import java.util.*; public class ch1 { public static void main(String args[]) throws ArithmeticException{ Scanner in =new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); long N = in.nextLong(); long K = in.nextLong(); N=2*N; if(N==2) out.print(2); else if(N%K==0) out.print(N/K); else out.print(N/K+1);
out.flush(); in.close(); out.close(); } } |
| Checker is fixed (+) | Samsonov Alex [USU] | 1822. Hugo II's War | 20 Mar 2011 00:31 | 1 |
We do apologize for this error. The runs from the contest are rejudged. |
| what answer? | Vit Demidenko | 1827. Indigenous Wars | 19 Mar 2011 22:59 | 1 |
what answer for 3 6 5 4 1 1 5 5 I think, it is 011 it's right? edited: no, answer is 000 Edited by author 20.03.2011 09:53 |
| No subject | clestro | 1820. Ural Steaks | 19 Mar 2011 22:10 | 8 |
if n=1 then time will be 2 :) zinoff, perhaps you've forgotten *2... where? can we speak out of foruM? |
| Fast IO helped me. | Vasya.V | 1827. Indigenous Wars | 19 Mar 2011 21:06 | 1 |
TL with scanf / putchar AC with fread / fwrite (0.281 s) Don't like problems with such hacks :\ |
| Standings | tereshinvs | | 19 Mar 2011 20:38 | 2 |
What is '? mm:ss' in standings table? The problem was submitted in last hour. |
| What is the meaning of this problem? | Martin | 1829. Routing Tables | 19 Mar 2011 19:57 | 2 |
Each routing table defines what gateway to use for every possible address (or that there is no gateway for some addresses). Hence, both routing tables from the input are mappings from addresses to gateways. The problem is to check equivalence of these mappings. |
| Test 3 | egor-belikov | 1823. Ideal Gas | 19 Mar 2011 19:08 | 2 |
Test 3 egor-belikov 19 Mar 2011 15:26 What is test 3? Can't find any mistakes, but WA#3. p=0 and n!=0 or otherwise |
| p = 0 ? Find V? | spiker | 1823. Ideal Gas | 19 Mar 2011 18:42 | 2 |
pV = nRT p = 0 (by your approach) T <> 0 (by description) n = 0 ? undefined n <> 0 ? error |
| problems with test | Eugene_Aslanov[SIAL] | 1820. Ural Steaks | 19 Mar 2011 18:38 | 3 |
It's so because you need to fry: 1 and 2; 2 and 3; 3 and 1; And that's all. |
| No subject | Denis Astanin (KPI) | 1826. Minefield | 19 Mar 2011 18:27 | 2 |
is greedy ok? Edited by author 19.03.2011 23:56 Greedy solution works just fine. |