| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| Help | PI-2014_Pelevin | 1785. Трудности локализации | 14 май 2014 00:33 | 2 |
Help PI-2014_Pelevin 7 май 2014 02:16 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) {
Console.WriteLine("vvedit a"); int a = int.Parse(Console.ReadLine()); if((1<=a)&&(a<=4)) Console.WriteLine("few") ; else if((5<=a)&&(a<=9)) Console.WriteLine("several"); else if ((10 <= a) && (a <= 19)) Console.WriteLine("pack"); else if ((20 <= a) && (a <= 49)) Console.WriteLine("lots"); else if ((50 <= a) && (a <= 99)) Console.WriteLine("horde"); else if ((100 <= a) && (a <= 249)) Console.WriteLine("throng"); else if ((250 <= a) && (a <= 499)) Console.WriteLine("swarm"); else if ((500 <= a) && (a <= 999)) Console.WriteLine("zounds"); else if ((1000 <= a) && (a <= 2000)) Console.WriteLine("legion");
} } } See on your selection statements. variable cannot be less then one and four at once. You maybe had in mind (1>=a)&(a<=4) |
| hehe | 大笨象=o=喳支枪 | 1037. Управление памятью | 13 май 2014 12:27 | 1 |
hehe 大笨象=o=喳支枪 13 май 2014 12:27 |
| WA15 with C++ but AC with Python | lennon310 | 1133. Последовательность Фибоначчи | 13 май 2014 08:43 | 1 |
I used C++11 with long long type, still cannot pass #15. After changing my code to python 2.7, I got the AC. Since the input range is [-2000000000,2000000000], long long type should not suffer from overflow. Then what's the reason of WA 15? |
| 1014 Pascal WA 3? | Dior | | 13 май 2014 06:59 | 1 |
uses crt; var s:string; a,k:longint; begin read(a); k:=9; repeat if a mod k=0 then begin s:=chr(k+48)+s; a:=a div k; end else k:=k-1; until k=1; if a=1 then begin write(s); end else write('-1'); end. Edited by author 13.05.2014 06:59 Edited by author 13.05.2014 07:22 Edited by author 13.05.2014 07:23 |
| WA #30 Any hints? | Baruvka | 1199. Мышка | 12 май 2014 23:24 | 2 |
Hint #1: The mouse or the cheese can be less than 10cm from the polygons Hint #2: Be careful of your first segment from the mouse or the last segment from the cheese. If you do not check correctly, they might cross a polygon. For example, think of the case of a very thin rectangle with the long side called A and a mouse that is less than 10cm from the rectangle. You have to make sure that the mouse runs to side A not the side opposite to A. |
| Why? | without | 1820. Уральские бифштексы | 11 май 2014 18:27 | 2 |
Why? without 9 май 2014 02:45 if n=1(k any) we need 2 minuten, but when n=2 , k=5 we need 1 minutes. Why??? this is bug, it is imposible. if i have n = 1 and k = 10000, i need two minutes |
| help me find the bug | Иван | 1880. Собственные числа Psych Up | 11 май 2014 15:46 | 1 |
i found the bug Edited by author 13.05.2014 22:15 |
| WA17 | George Agapov | 1791. Дядя Стёпа и автобусы | 11 май 2014 14:17 | 3 |
WA17 George Agapov 31 окт 2010 02:19 Any ideas, what's wrong? (I used greedy alogorithm) I've this test wrong too. Here's my code: #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <utility> #include <set> #include <ctime> using namespace std; #define forn(i,n) for (int i = 0; i < (int)n; i++) struct bus { int l, r, type, num; friend bool operator<(const bus &bus1, const bus &bus2) { if (bus1.type != bus2.type) { return bus1.r < bus2.r; } else { return bus1.num < bus2.num; } } }; int n, m; vector<pair<int, int> > v1, v2; bus mas[300000]; multiset<bus> s; multiset<bus>::iterator iter; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); scanf("%d", &n); v1.resize(n); forn(i,n) { scanf("%d%d", &v1[i].first, &v1[i].second); v1[i].second += v1[i].first - 1; } scanf("%d", &m); v2.resize(m); forn(i,m) { scanf("%d%d", &v2[i].first, &v2[i].second); v2[i].second += v2[i].first - 1; } for (int i = 1; i <= n; i++) { mas[i].l = v1[i - 1].first; mas[i].r = v1[i - 1].second; mas[i].type = 1; mas[i].num = i; } for (int i = 1; i <= m; i++) { mas[i + n].l = v2[i - 1].first; mas[i + n].r = v2[i - 1].second; mas[i + n].type = 2; mas[i + n].num = i; } int p1 = 1, p2 = n + 1; int t = min(mas[p1].l, mas[p2].l); while ((p1 <= n && p2 <= m + n) || t <= 230000000) { while (p1 <= n && mas[p1].l <= t) { if (mas[p1].r < t) { printf("NO"); return 0; } else { s.insert(mas[p1++]); } } while (p2 <= m + n && mas[p2].l <= t) { if (mas[p2].r < t) { printf("NO"); return 0; } else { s.insert(mas[p2++]); } } iter = s.begin(); if (iter != s.end()) { if ((*iter).r < t) { printf("NO"); return 0; } else { s.erase(iter); } t++; } else { t = 230000000; if (p1 <= n) { t = min(t, mas[p1].l); } if (p2 <= n + m) { t = min(t, mas[p2].l); } if (t == 230000000) { printf("YES"); return 0; } } } printf("YES"); //printf("%.5lf", 1.0 * clock() / (1.0 * CLOCKS_PER_SEC)); } Where's bug? Re: WA17 Vit Demidenko 11 май 2014 14:17 1 1 3 2 1 4 1 2 answer is "YES" |
| be careful... | Adhambek | 1242. Оборотень | 10 май 2014 20:25 | 1 |
WereWolf can eat his sister or brother. But He cannot eat his father and mother, also grandfather ... so on....grandmother... |
| Error in sample | Darwin's Grove | 1917. Руины титанов: убийственная точность | 10 май 2014 20:01 | 2 |
Sample 5 4 4 1 4 1 2 Why answer is 3 2 but not 3 1 ? 2*1+1*2 <= 4 (p = 4, p — максимальная сила всплеска, которую маги ещё могут пережить, пережить тоесть включно) ??? To kill the weakest 3 coins with one spell it would have to have spell power 2, which means you get 3*2 = 6 > 4 damage reflected. |
| Please, enable Java | Sergey Filipkov | 1395. Pascal против C++. Версия 2 | 10 май 2014 02:54 | 1 |
I strongly dislike being forced to specific languages. Java is too slow to solve the problem? OK. Why ban it? |
| 1001 - Pascal | Dior | 1001. Обратный корень | 7 май 2014 21:09 | 1 |
var n:integer; begin while not seekeof do begin read(n); write(sqrt(n):0:4); end; end. Wrong answer, but why??? |
| Why is this WA (#2)? | mbrc | 1120. Сумма последовательных чисел | 7 май 2014 13:12 | 2 |
#include <cmath> #include <cstdio> #include <iostream> using namespace std; typedef long long LL; int main() { LL N,A,P,up; cin>>N; up=(LL)ceil((1.00+sqrt(1.00+8.00*(double)N))/2.00); P=up; while (((2*N)%P)!=0) { P--; }
A=(((2*N)/P)-P+1)/2;
cout<<A<<" "<<P<<endl; } This is my code...but this is giving WA on #2. I can't understand the reason. It seems to give correct answer on the tests I do on my computer..?!
At first sight, I strongly suggest you to avoid operating repeteadly with floating points, the little errors will accummulate, and WA comes to the order. at second sight the logic is just not right. Look, I got the same algorithm that a dude with TLE at test9, but with a less complex break condition. private static int sq(long A,long N){ double aux= Math.sqrt( ((A*A)<<2) - (A<<2) + 1 + 8*N); int r = (int)aux; if ((double)r==aux) return r; else return -1; } public static void main (String[]args){ Scanner s=new Scanner(System.in); int N= s.nextInt(); long A=1,P=1,root=0; while (true){ root= sq(A,N); if (root==-1) A++; else{ P= (1-(A<<1)+root)/2; break; } } System.out.println(A+" "+(P)); } |
| May program responds correctly. but why that's answered me Runtime error why? In JAVA 1.7 | Axmadjon | 1011. Кондукторы | 7 май 2014 12:05 | 1 |
import java.util.Scanner; public class _1011 { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); double p, q; p = Double.parseDouble(s.nextLine()); q = Double.parseDouble(s.nextLine()); p /= 100; q /= 100; answer(p, q, 1, 1, 0); } public static void answer(double p, double q, double m, double mp, long n) { long t = (long) (m / q) + 1; if (p * t < mp) { System.out.println(n + t); } else { answer(p, q, 1 - q * t + m, 1 - p * t + mp, n + t); } } } |
| please help me what Memory limit exceeded in test4 JAVA | Axmadjon | 1048. Сверхдлинные суммы | 7 май 2014 11:31 | 1 |
import java.util.Scanner; public class _1048 { public static void main(String[] args) throws Exception { Scanner s = new Scanner(System.in); int n, ind, i; n = s.nextInt(); int[] a = new int[n]; int[] b = new int[n]; int[] res = new int[n]; for (i = 0; i < n; i++) { a[i] = s.nextInt(); b[i] = s.nextInt(); } for (i = n - 1; i >= 1; i--) { ind = (a[i] + b[i]) / 10; if (ind > 0) { res[n - i] = ind; res[n - i - 1] += (a[i] + b[i]) % 10; } else res[n - 1 - i] += a[i] + b[i]; if (res[n - i - 1] >= 10) { res[n - i] += res[n - i - 1] / 10; res[n - i - 1] = res[n - i - 1] % 10; } } res[n - 1] += a[0] + b[0]; for (i = n - 1; i > -1; i--) System.out.print(res[i]); } } |
| Accepted in Java 1.7 | Axmadjon | 1021. Таинство суммы | 7 май 2014 10:49 | 1 |
[delete] Edited by author 07.05.2014 10:53 Edited by author 07.05.2014 10:53 |
| please help me what Wrong answer in test 6 JAVA | Axmadjon | 1645. Лыжная гонка | 7 май 2014 10:22 | 1 |
import java.util.Scanner; public class _1645 { public static void main(String[] args) { Scanner s = new Scanner(System.in); int i, j; long n, min, max; n = s.nextInt(); long[] a = new long[(int) n]; for (i = 0; i < n; i++) { a[i] = s.nextInt(); } for (i = 0; i < n; i++) { min = 1; max = n; for (j = 0; j < n; j++) { if (j > i & (a[j] < a[i])) { min++; } if (j < i & (a[j] > a[i])) { max--; } } System.out.println(min + " " + max); } } } |
| The correct formula | lopezio | 1209. 1, 10, 100, 1000... | 6 май 2014 21:13 | 1 |
Here is the formula to find the 1 numbers: (sqr(n)+n+2)/2 n varies from 0 to .... |
| I have got a question concerning TASK 1209. Please help me if you can. | Kirill_1984 | 1209. 1, 10, 100, 1000... | 6 май 2014 19:59 | 1 |
Here is the code for the mentioned task. I use Dev-Pascal and when I run it on my computer there is no any problem, but when I send it to the server the following error occurs: "Runtime error (access violation)" MY CODE: program TASK_1209; var b, x, y: string; a: real; i, n, w, k: integer; begin x := '1' + x; for i:=1 to 10 do begin a := exp(ln(10) * i); str(trunc(a), b); x := x + b; end; readln(k); n := 0; repeat n := n + 1; readln(w); y := y + x[w] + ' '; until n = k; write(y); readln; end. |
| I have AC in Java 1.7 | Axmadjon | 1991. Битва у болота | 6 май 2014 19:09 | 1 |
|