| Show all threads Hide all threads Show all messages Hide all messages |
| WA3 | Svetochek | 1157. Young Tiler | 2 Feb 2013 18:19 | 2 |
WA3 Svetochek 6 Apr 2012 21:16 Maybe cause you forget about "no solution" or L > 10000 cases. I got AC after these checks. |
| Wrong Answer | Vinicius Zhu | 1001. Reverse Root | 2 Feb 2013 15:02 | 3 |
Can anyone tell me where I am mistaken? #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { unsigned int input[65536]; int counter=0; while(scanf("%u", &(input[counter++])) != EOF); while (counter-- > 0) printf("%.4f\n", sqrt((double)(input[counter]))); return 0; } Edited by author 19.10.2012 22:03 why don't you use 'double' or 'long double' for input[65536] directly? |
| Why crash ? Help please | Lai Manh Tuan | 1001. Reverse Root | 2 Feb 2013 14:57 | 3 |
import java.util.Scanner; import java.text.*; public class Main { public static void main (String [] args) { Scanner kb = new Scanner (System.in); DecimalFormat df = new DecimalFormat("#.0000"); int dem = 0; String inra; double [] data = new double [50000]; while (kb.hasNextDouble()) { data[dem] = kb.nextDouble (); dem++; } for (int i = dem-1; i >= 0; i--) { inra = df.format (Math.sqrt(data[i])); if (inra.charAt (0) == '.') inra = "0" + inra; System.out.println (inra); }
} } I used List<Double> = new ArrayList<Double>(); and it worked without crash. ---- public class Main { public static void main (String [] args) { ... String inra; List<Double> coll = new ArrayList<Double>(); while (kb.hasNextDouble()) { coll.add(kb.nextDouble()); } for(int j = coll.size() - 1; j >= 0; j--) { inra = df.format (Math.sqrt(coll.get(j))); if (inra.charAt (0) == '.') inra = "0" + inra; System.out.println (inra); } } } ---- or following will work double [] data = new double [140000]; Edited by author 25.01.2013 22:05 Edited by author 25.01.2013 22:05 Edited by author 25.01.2013 22:41 |
| What am I doing wrong? | Jamshid Akhmedov | 1642. 1D Maze | 2 Feb 2013 14:56 | 2 |
Edited by author 02.02.2013 13:33 |
| Java. Test 4. Error | Vladimir Usychenko | 1001. Reverse Root | 2 Feb 2013 05:37 | 2 |
public static void main(String[] args) throws Exception {
in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); tok = null;
List<Long> listLong = new ArrayList<Long>(); while (true) { try { listLong.add(readLong()); if (!in.ready()) { throw new Exception(); } } catch(Exception ex) { break; } } for (int i = listLong.size() - 1; i >= 0; i--) { Double dbl = (double)listLong.get(i); BigDecimal bigDecimal = new BigDecimal(Math.sqrt(dbl)); bigDecimal = bigDecimal.setScale(4, BigDecimal.ROUND_HALF_UP); out.println(bigDecimal.toPlainString()); } out.flush(); } It fails on a test №4. Does somebody know why? public class Main { public static void main(String[] args){
Scanner in = new Scanner(System.in); PrintWriter out = new PrintWriter(System.out); ArrayList<Long> l=new ArrayList<Long>(); try{ while(in.hasNext()){ l.add(in.nextLong()); } } catch(Exception e){} finally{ in.close(); }
} } maybe use,correct read? Long type |
| C# Can you please tell me why ? HELP ! | lanjiashu | 1001. Reverse Root | 1 Feb 2013 14:01 | 5 |
my english is poor so this is the program using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Collections; namespace ACM1001test { class Program { static void Main(string[] args) { string[] arr = (Console.ReadLine()).Split(' '); Stack sck = new Stack(); for (int i = 0; i < arr.Length;i++ ) { sck.Push(arr[i]); } foreach (string str in sck) { int a=Convert.ToInt32(sck.Pop()); Console.WriteLine("{0}/n",Math.Round(Math.Sqrt(a), 4)); } } } } 1. string[] arr = (Console.ReadLine()).Split(' '); Number of lines may be more then one, use cycle 2. the number of spaces between the numbers of more than one, use Console.ReadLine().Split(new char[] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries) 3. Int32<10^18; thanks Alksar so i made some changes but some problems is still here .this is the new program class Program { static void Main(string[] args) { string[] arr = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); Stack sck = new Stack(); for (int i = 0; i < arr.Length;i++ ) { sck.Push(arr[i]); } foreach (string str in sck) { ulong a=Convert.ToUInt64(sck.Pop()); Console.WriteLine("{0}/n",Math.Round(Math.Sqrt(a), 4)); } } } when i input the "16 4" the computer output the "20" so awkwardful..... I have changed your program just a little, it works nice namespace ACM1001test { class Program { static void Main(string[] args) { string[] arr = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); Stack sck = new Stack(); for (int i = 0; i < arr.Length; i++) { sck.Push(arr[i]); } while (sck.Count>0) { ulong a = Convert.ToUInt64(sck.Pop()); Console.WriteLine(Math.Round(Math.Sqrt(a), 4)); } Console.ReadKey(); } } } thanks but when i input "16 4"the computer also output "20" when i submit the program i get the Crash and i used the others Program which use C# have got the AC,they also output "20". it is not should put out"2 4"? or i am not understand the meaning... |
| WA 6? | x_files_01 | 1787. Turn for MEGA | 1 Feb 2013 04:33 | 1 |
WA 6? x_files_01 1 Feb 2013 04:33 That is my code on c++ #include <iostream> #include <stdio.h> using namespace std; int main() { int k, n; scanf ("%d %d", &k, &n); int *mas = new int [n]; for (int i = 0; i < n; i++) { scanf("%d",&mas[i]); } int sum = 0; for (int i = 0 ; i < n ; i++) { sum+=mas[i] - k; } delete[]mas; if (sum<0) { sum = 0; cout<<sum; return 0; } cout<<sum; return 0; } |
| No subject | Jumper | 1904. The Lessons of the Past | 1 Feb 2013 00:03 | 1 |
Edited by author 01.02.2013 09:18 |
| Why are blossoms needed? | Carlos Colmenares | 1099. Work Scheduling | 31 Jan 2013 23:26 | 1 |
Hello all, I've been studying this topic lately, and I came out with a question which answer I have not been able to find anywhere. I know very well the history about Edmonds' Blossom algorithm, however, it is well known that a given matching is the maximum one if no more augmenting paths can be found on the graph. So, my question is the following one: I implemented a simple DFS algorithm that tries to find an augmenting path, and if found, it makes the flip we all know and adds/removes the flipped edges to the matching. In my DFS I only mark nodes that are reached in even levels (i.e. nodes found after following a matched edge, plus the first unmatched node) as visited, furthermore I also care about the nodes in the active path so as to avoid stepping in the same node and generating cycles. So, why this does not work? of course the reason is because there are augmenting paths my algorithm cannot find, but why? All of this converges to a simple question: why in Edmonds' algorithm is it necessary to shrink blossoms? I've read many papers where it is explained how to shrink blossoms and why an augmenting path in the reduced graph is still valid in the expanded one, but they never explain why this is actually necessary! Thanks for your help. |
| AC | Jamshid Akhmedov | 1832. Arirang Show | 31 Jan 2013 21:46 | 1 |
AC Jamshid Akhmedov 31 Jan 2013 21:46 /* * Created by SharpDevelop. * User: Жамшидбек * Date: 31.01.2013 * Time: 20:02 * * To change this template use Tools | Options | Coding | Edit Standard Headers. */ using namespace System; int main(array<System::String ^> ^args) { Console::WriteLine(L"Hello World"); return 0; } |
| AC using C# | Jamshid Akhmedov | 1545. Hieroglyphs | 31 Jan 2013 21:41 | 1 |
using System;namespace jama{class Program{static void Main(string[] args){ushort n = ushort.Parse(Console .ReadLine());string[] a = new string[n];for (ushort i = 0; i <= n - 1; i++){a[i] = Console.ReadLine();}string b = Console.ReadLine();foreach (string d in a){if (d.Substring(1,1) == b)Console.WriteLine(d);}Console.ReadLine();}}} |
| Russian translation. | Tolstobrov Anatoliy[Ivanovo SPU] | 1917. Titan Ruins: Deadly Accuracy | 31 Jan 2013 12:36 | 1 |
Incorrect: "которую могут маги ещё могут пережить" Correct: "которую маги ещё могут пережить" |
| Scala support | Nikolay Ulyanov | | 30 Jan 2013 06:05 | 2 |
Hello, is it possible to add support for this beautiful language? Thanks. and I hope Python is the next language to add. Of course, more languages offer more choices. |
| Hint? | nistaman | 1239. Ghost Busters | 30 Jan 2013 00:56 | 4 |
Hint? nistaman 15 Oct 2006 03:38 Can someone give me a hint for this task? Thanks! Project everything onto sphere R=1, now you have 2D problem because Z can be evaluated from X and Y. Projections' countours will be circles. Then find limiting Y - i.e. Y values for which some particular projection has only one point on that R=1 sphere. Then find all Y values for which two projections start/stop intersecting. For every pair of projections there will be at most 2 such Y values, so we will have at most O(N^2) control Y points. Now, for each particular Y value each projection will constitute some [X1;X2] interval and it becomes a classic point-in-max-number-of-segments problem (O(N*log(N)). So, the overall complexity is O(N^3*log(N)). And a lot of math about square equations. Edited by author 05.08.2008 19:02 Edited by author 05.08.2008 19:57 Edited by author 05.08.2008 20:00 Edited by author 05.08.2008 19:49 overall complexity is O(N^3) |
| Punctuation error in russian version of problem condition | underminer | 1402. Cocktails | 30 Jan 2013 00:12 | 2 |
In the fourth sentence they should insert a comma after the third word. Edited by author 30.01.2013 00:12 |
| What is the test 2??? | Dark Cleaner | 1515. Cashmaster | 29 Jan 2013 23:44 | 1 |
My first program gives right answers for all the extremal tests, that I think out for my AC program, but it can not pass this test with diagnosis "Crash (access violation)". Why? What checks this test? Edited by author 30.01.2013 01:45 |
| Still dont see why i get "Crash" | Andrey | 1910. Titan Ruins: Hidden Entrance | 29 Jan 2013 21:18 | 1 |
Guys, i run program and it works. Why does it crash? Could you point me to the problem in my code? public static void main(String[] args) throws IOException { int sum=0; Scanner s = new Scanner (System.in); int a = s.nextInt (); BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); String s1 = br.readLine (); for (int i = 0; i<a-2; i++) { if (s1.charAt (i)==s1.charAt (i+1) && s1.charAt (i) == s1.charAt (i+2)) { String s2 = Character.toString (s1.charAt (i)); sum = Integer.parseInt (s2); System.out.print (sum*3 + " "); } } for (int i = 0; i<a-2; i++) { if (s1.charAt (i)==s1.charAt (i+1) && s1.charAt (i) == s1.charAt (i+2)) { System.out.print (s1.indexOf(s1.charAt (i))+2); } |
| No subject | Andrey | 1910. Titan Ruins: Hidden Entrance | 29 Jan 2013 16:20 | 3 |
Is input always made in given range or your tests may input not allowed numbers (like -1) and i must write code to handle this input error? Must this numbers 1 4 4 4 1 1 be randomly generated or what? Must numbers other than 4 (in this case) be always 1? Or be the same? Edited by author 25.01.2013 20:56 Edited by author 25.01.2013 20:56 The input data is in the given range. As you can see from the problem statement, instead of the 1 and 4 there could be any number in range [1, 1000000]. Guys, I get 'Crash' message but cant undrestand why. I run programm and it does what it has to do. Could u please look look at the code ant point me to the problem? This is JAVA public static void main(String[] args) throws IOException { int sum=0; Scanner s = new Scanner (System.in); int a = s.nextInt ();
BufferedReader br = new BufferedReader (new InputStreamReader (System.in)); String s1 = br.readLine ();
for (int i = 0; i<a-2; i++) { if (s1.charAt (i)==s1.charAt (i+1) && s1.charAt (i) == s1.charAt (i+2)) { String s2 = Character.toString (s1.charAt (i)); sum = Integer.parseInt (s2); System.out.print (sum*3 + " ");
} }
for (int i = 0; i<a-2; i++) { if (s1.charAt (i)==s1.charAt (i+1) && s1.charAt (i) == s1.charAt (i+2)) {
System.out.print (s1.indexOf(s1.charAt (i))+2);
}
|
| WA2 | Majo | 1777. Anindilyakwa | 29 Jan 2013 16:02 | 3 |
WA2 Majo 20 Jan 2013 13:09 My program is right for this test. |
| WA -8 ! | Iacob Vlad | 1786. Sandro's Biography | 29 Jan 2013 13:11 | 2 |
WA -8 ! Iacob Vlad 27 Nov 2011 20:45 first 7 tests are all strings of length 6. so if you wa 8, your program may not handle string of length > 6. |