| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| if you WA 5 try this | yuzeming | 1122. Игра | 12 сен 2010 06:49 | 1 |
|
| I've got WA 1. Please Help. | MadMag | 1030. Титаник | 11 сен 2010 08:54 | 2 |
#include<stdio.h> #include<math.h> #include<algorithm> using namespace std; #define PI 3.1415926535897932384626433 int lat1, lat2, lat3, lon1, lon2, lon3, trash; char latc, lonc; long double latf, lats, lonf, lons; long double sq(double x){ return x*x; } int main(void){ scanf("Message #%d.\nReceived at %d:%d:%d.\nCurrent ship’s coordinates are\n%d^%d'%d\" %cL\nand %d^%d'%d\" %cL.\n", &trash, &trash, &trash, &trash, &lat1, &lat2, &lat3, &latc, &lon1, &lon2, &lon3, &lonc); lats = (latc=='N'?1:-1)*(lat1 + (lat2 + lat3/60.0)/60.0)*PI/180.0; lons = (lonc=='W'?-1:1)*(lon1 + (lon2 + lon3/60.0)/60.0)*PI/180.0; scanf("An iceberg was noticed at\n%d^%d'%d\" %cL\nand %d^%d'%d\" %cL.", &lat1, &lat2, &lat3, &latc, &lon1, &lon2, &lon3, &lonc); latf = (latc=='N'?1:-1)*(lat1 + (lat2 + lat3/60.0)/60.0)*PI/180.0; lonf = (lonc=='W'?-1:1)*(lon1 + (lon2 + lon3/60.0)/60.0)*PI/180.0; double dlon = lonf - lons, dlat = latf - lats; double a = acos(sin(lats)*sin(latf) + cos(lats)*cos(latf)*cos(dlon)); double len = 3437.5*a; printf("The distance to the iceberg: %.2lf miles.\n", len); if(100.00-len>0.005) printf("DANGER!\n"); return 0; } Am I wright about input? Have you debugged locally? Change the word "ship’s" to "ship's" and you'll get AC. Anyway, your algorithm is amazing. For example, you even don't use epsilon in "if(100.00-len>0.005)"... Very impressive. |
| why is wrong #5 | Yeqianqian | 1025. Демократия в опасности | 11 сен 2010 07:14 | 1 |
#include<iostream> #include<vector> using namespace std; int main() { int k; cin>>k; vector<int> p; for(int i=0,a=0;i<k;i++) {cin>>a; p.push_back (a); } for(int temp=0,j=0;j<k-1;j++) { if(p[j]>p[j+1]) { temp=p[j]; p[j]=p[j+1]; p[j+1]=temp; } }
int out=0; for(int b=0;b<=k/2;b++) out=out+p[b]/2+1; cout<<out<<"\n"; return 0; } |
| if you WA all time . | F.u | 1029. Министерство | 11 сен 2010 07:09 | 1 |
Hint confuse you .You must use long long . I use int that #14 WA all time. It's all. |
| OLE #4 I think I need help~~ | ChenXiangRu | 1438. Time Limit Exceeded | 11 сен 2010 05:51 | 4 |
I was also stunned by this test, now I have AC. i = 0 j = 0 loop1: loop2: j = j + 1 if j < i goto loop2 j = 0 i = i + 1 if i < 100 goto loop1 (Consecutive labels) Good luck. Edited by author 12.08.2006 12:28 I think that your program incorrectly interprets input program. For example, there are cycle in which there are print operation and your program incorrectly works with this cycle. Maybe your program enters in infinite cycle in that case. (The cycle is 'label' and 'goto label') I advise you examine work with labels. check for backward and forward links x = 1 goto lab x = 10 lab: x = x + 1 if x < 3 goto lab print x |
| Hey! Second test (in sample) is wrong!!! | AterLux | 1438. Time Limit Exceeded | 11 сен 2010 05:49 | 2 |
Why Value and ValueA is 3 ? Remainder of -2499999 divided by 6 or -6 is -3 in both cases! -2499999 / 6 = -416666 -2499999 - (-416666 * 6) = -3 and same for -6. Please correct tests or describe in task the way to find quotient and remainder of division Edited by author 11.09.2010 03:13 Got AC using this: Rem := A mod B; if Rem < 0 then Inc(Rem, Abs(B)); But I still thinking this is not correct, because A = -123456 B = 321 D = A / B R = A % B X = D * B X = X + R print A print X this both should be the same |
| Test #4 is incorrect or wrong | Alias (Alexander Prudaev) | 1438. Time Limit Exceeded | 11 сен 2010 02:55 | 5 |
i am sure that my program is ok, but wa#4 Absolutely agree. There must be some unappropriate program... Very many authors has AC and test4 passed. It's impossible to be mistaken for all! There for there is chance to find yours mistakes and to improve your opportunities. Edited by author 07.09.2007 21:35 i have got AC. try test like this a = 1; goto label1 a = 2 label1: print a or label1: a = 1 goto label1 a = 2 print a try this. I was mistaken, when same label used for forward and backward reference. Fixed and got AC ;) x = 0 goto l print 0 l: x = x + 1 print x if x < 3 goto l Edited by author 11.09.2010 05:41 |
| Give me answer for my question. Please! | {AESC USU} Evgeny Kurpilyanskij | 1438. Time Limit Exceeded | 11 сен 2010 02:30 | 5 |
if (a == b*q+p) and (0 <= p < |b|) then { q == a / b p == a % b } is it TRUE? Edited by author 13.02.2007 14:34 a % b == p - correct a / b is standard (just a / b in your programming language) To WiNGeR: I should use SIGHNED INT32 or UNSIGHNED INT32 P.S. Sorry for bad English. Edited by author 13.02.2007 18:57 0 <= |p| < |b| correct because if p = a - b * q, and q = a / b, you can see, p should be negative for negative a. But sample test provides positive remainder. I think this is mistake in tests. Use this p = a % b; if (p < 0) p += abs(b); Edited by author 11.09.2010 05:45 |
| WA WHY ????? | lemay | 1025. Демократия в опасности | 10 сен 2010 11:35 | 2 |
[code deleted] Edited by moderator 20.11.2019 00:22 qsort((void*)a,i,sizeof(int),sort); -> qsort((void*)a,n,sizeof(int),sort); |
| What do you think about random? | BlackShark | 1082. Иванушка-дурачок | 10 сен 2010 00:59 | 2 |
Tell me please, why my C++ code has WRONG ANSWER 1 #include <iostream> #include <set> using namespace std; int main() { int N; cin>>N; srand((int)__TIME__); set <int> arr; while (arr.size()!=N) { int temp = rand()%(N+1); if (arr.find(temp)==arr.end() && temp!=0) { cout<<temp<<" "; arr.insert(temp); } } return 0; } it is not standart solution, but it is right |
| This is time for pascal ;-) | [SESC USU] Efanov N. | 1759. Долгожители | 9 сен 2010 23:54 | 1 |
Pascal's type TDateTime (module SysUtils) allow decide this problem in 10 strings. |
| new flashmob on timus | Baurzhan | | 9 сен 2010 09:40 | 1 |
Let's solve problems which have the same number with your rank in authors ranklist. Milanin is lucky=) |
| No subject | SHAN2 | 1068. Сумма | 8 сен 2010 21:31 | 1 |
|
| test 5 | abdkanan | 1295. Бред | 8 сен 2010 21:29 | 2 |
test 5 abdkanan 10 фев 2006 02:49 Re: test 5 Pustovalov Evgeny [Ekaterinburg SESC USU] 8 сен 2010 21:29 А ты подставь 300000, работать будет? ;) And you substitute 300000, will work?;) |
| PASCAL AC Solution 9 lines!!!! | George Skhirtladze | 1068. Сумма | 8 сен 2010 19:59 | 2 |
var n,i:longint; begin read(n); if n<=0 then begin n:=n*-1; write(((n*(n+1))div 2)*-1+1); end else writeln(n*(n+1)div 2); end. Edited by author 13.04.2010 16:42 Edited by author 13.04.2010 16:43 Use single formula, without 'if'-condition. Hint: Use Abs() |
| Помогите!!!Лимит времени(= | Dj_Denis | 1423. Басня о строке | 7 сен 2010 22:34 | 3 |
Что здесь поменять чтоб количество циклов было меньше... var n,x,i,j,t:integer; a,b:array[1..250000]of char; tempchar,ch:char; label fin,step; begin readln(n); x:=-1; for i:=1 to n do read(a[i]); readln; for i:=1 to n do read(b[i]); readln; i:=1; while i<=n do begin j:=1; while j<=n do begin if j=1 then begin tempchar:=a[1]; a[1]:=a[n]; end else begin ch:=a[j]; a[j]:=tempchar; tempchar:=ch; end; j:=j+1; end; for t:=1 to n do if a[t]=b[t] then x:=i else begin x:=-1;goto step; end; if i=n then x:=0; goto fin; step:i:=i+1; end; fin:write(x); end. Your realisation is 'naive', takes in worst case O(N^2) operations. for 250000 it's about 62,5 billions iterations. It will take almost 1 minute on even strong CPU's Use, for example, hash function. Try test with 249999 equal symbols and one another Избежать лемит времени можно написав КМП ;) |
| I have Knut_Morris_Pratt Algo, but why do I have WA#8? | Alexey | 1423. Басня о строке | 7 сен 2010 20:37 | 3 |
Someone knows what is that test? give me some tests please... I got AC (with time 0,5 sec), using cyclic 64bit xor-hash. Try test like that: 250000 aaaaaaaaa .... (fill this with 'a') ... aaaaaB aaaaaa .... aaaBaaaaa .... aaaaaa or (in second line) Baaaa .... or aaaaa ..... aaaaaBa |
| Hint for test#10 | Nguyễn Kim Vỹ | 1116. Кусочно-постоянная функция | 7 сен 2010 07:55 | 3 |
increase size of array. 15000 (not 14999) Edited by author 25.07.2010 03:39 Edited by author 25.07.2010 03:40 AC!! ░▒ Nguyễn Kim Vỹ ▒░ 25 июл 2010 03:32 Edited by author 25.07.2010 03:40 increase size of array. THE ANS ARRAY 50000!!! |
| some tests | Georgiy Platonov | 1665. Финансовая пирамида декана | 6 сен 2010 21:45 | 1 |
Here some testcases and my AC program's answers. May be these would be helpful for you. Good Luck. 10 NO 100 YES 1000 YES 8 YES 16 NO 32 YES 64 NO 125 YES 126 YES 1 NO 12345678 YES 17 YES 107 YES 267 YES 2992 YES 987456 YES 769 YES 896 NO 1536 NO 796 YES |
| Help!!! Wrong answer! test #1,what does it means? | GaoHughes | 1079. Максимум | 6 сен 2010 21:37 | 1 |
#include<iostream> using namespace std; void K(int); void main() { int b[10],j=0,k=0; for(;j<10;j++) { cin>>b[j]; if(b[j]==0) break; } for(;k<j;k++) K(b[k]); }
void K(int n) { if(n!=1) { n++; int *a = new int [n]; a[0]=0; a[1]=1; int i=2; for(;i<n;i++) { if(i%2==0){a[i]=a[i/2];} else {a[i]=a[(i-1)/2]+a[(i-1)/2+1];} } if(n%2==0){cout<<a[n-1];} else {cout<<a[n-2];} cout<<endl; } else { cout<<0<<endl; } } |