| Show all threads Hide all threads Show all messages Hide all messages |
| 0's answer is 10,but for 1 to 9,it's itself...just don't understand.. | yangqiang | 1014. Product of Digits | 12 Nov 2009 08:56 | 2 |
|
| WA 11, what can be wrong? | Mansur | 1601. AntiCAPS | 12 Nov 2009 08:10 | 2 |
Here my code #include<iostream> using namespace std; void main() { char c,str[10000]; int f=0,i=0; while (cin.get(c)) { if (c=='!'||c=='?'||c=='.') {f=0; str[i]=c; i++;} else if (c>='A'&&c<='Z') { if (f!=0) {str[i]=c-'A'+'a'; i++;} else {str[i]=c; i++; f++;} } else {str[i]=c; i++;} } cout<<str; } Hello; Pay attention: "Total length of message is not exceeding 10000 symbols." try with an input containing 10000 symbols. for eg: if the input contain 10000 H (HH.........HHH ) your programm output: Hhhh...........hhh®Àw$üÓÓ¶€|¨ÿ"HÐ)> the problem is in the function "cout" So don't stock c in str; just print it. i hope that's help you. |
| Помогите!!! | Dj_Denis | 1644. A Whole Lot of Walnuts | 11 Nov 2009 22:54 | 1 |
На 7 или на 8 тесте ошибка но все тесты что я видел все правильно идут вот код: var state:string; n,i,k,max,min:integer; h,s:boolean; begin readln(n); min:=10; max:=3; for i:=1 to n do begin readln(k,state); delete(state,1,1); if state='hungry' then begin if h=false then begin max:=k; h:=true; end; if max<k then max:=k; end else begin if s=false then begin min:=k; s:=true; end; if min>k then min:=k; end; end; if max>=min then write('Inconsistent') else write(min); end. |
| I have a problem. EXPLAIN ME! Please! | Alexey | 1024. Permutations | 11 Nov 2009 19:52 | 10 |
I Have a problem. Explain me. 1 2 3 4 5 4 1 5 2 3 1 2 3 4 5 2 4 3 1 5 1 2 3 4 5 4 1 3 2 5 1 2 3 4 5 2 4 3 1 5 ... What shall I do? Edited by author 07.08.2005 19:54 I repeated it for 6 times and I didn't have 1 2 3 4 5 You must apply FIRST permutation to change sequence!!! Look: 4 1 5 2 3 2 4 3 1 5 1 2 5 4 3 4 1 3 2 5 2 4 5 1 3 1 2 3 4 5 Every time you do the following actions: b[i] := a[b[i]]; where a - first (initial) permutation and b - current permutation. Or to give theories under the decision of problems(I think at you is). And that at me while is not present the teacher. Thanks Alex Stoff 16 Aug 2005 21:39 Thank you very much. If really helps me. I understood. |
| Grammar clarifications | Denis Koshman | 1345. HTML | 11 Nov 2009 16:20 | 3 |
Got AC 0.001 sec from the first effort :) I saw many requests for clarification here, but it's easier to describe grammar in terms of behavior. Go sequentially through input data. 1. If you meet '{' - everything until closest corresponding '}' is a single comment, no matter what's inside. '}' corresponds to '{' if all {,} characters between them form valid bracket sequence. 2. If you meet '//' - everything until '\n' is a single comment, no matter what's inside. 3. If you meet ' - everything until next ' is a string, no matter what's inside. 3. If you meet '#' followed by a digit - everything until first non-digit is a string. 4. If you meet a digit, then everything until first non-digit is a number. If first non-digit character is '.' AND it is followed by another digit, then this post-dot digit sequence is appended to the number as well as the dot itself. I.e. "1.23" is a single number, but "123.a" is number '123' followed by '.', followed by identifier 'a'. 5. If you meet underscore or letter, everything until first non-digit-non-underscore-non-letter is an identifier. It may be a keyword. 6. Output all other characters as is. Edited by author 17.08.2008 01:02 These statements should be stated in problem description. They are all right and to recreate them I tried 50 submissions. In western sytes it is a rule punctual and clear descriptions all conditions but in our country often used believeness in super talantedness of us. Edited by author 10.01.2009 20:26 Really helpful! Link to this post should be added to the statement :-) |
| Bug in russian statement | Oracle[Lviv NU] | 1345. HTML | 11 Nov 2009 16:16 | 1 |
<PRE> and a line </PRE> replace "and a line" with it's translation (и строку) :-) |
| Please help!!!! | 902 group (RAU) | 1021. Sacrament of the Sum | 10 Nov 2009 21:53 | 2 |
Please help!!!Tell me what is wrong in my algo???Help to orgonise input!Here is my code: #include <iostream.h> int main() { const int N=50000; int x[N],y[N]; bool s; int i,k; int a,b; cin>>a; for(i=0;i<a;i++) { cin>>x[i]; } cin>>b; for(i=0;i<b;i++) { cin>>y[i]; } for(i=0;i<a;i++) { for(k=0;k<b;k++) { if(x[i]+y[k]==10000) { s=true; } if(x[i]+y[i]!=10000) { s=false; } } } if(s=true) { cout<<"YES"<<endl; } if(s=false) { cout<<"NO"<<endl; } return 0; } You must finish your iterations and print "YES", if an appropriate pair of numbers is found. Now your program outputs the value of the 's' for the last pair, x[a-1] and y[b-1]. But this algo can be substantially optimized. |
| WA#6 | VorobeY1326 | 1023. Buttons | 10 Nov 2009 19:51 | 1 |
WA#6 VorobeY1326 10 Nov 2009 19:51 Help somebody!! Why my code has WA6..or GIVE SOME TESTS, please)) #include<iostream> #include<vector> #include<cmath> using namespace std; vector<int>easy_numbers(0); int next_number(int numb_of_numb) { int step=easy_numbers.size()-1; int curr_number=easy_numbers[step]; while(step+1<numb_of_numb) { while(1) { curr_number++; int sq_root=sqrt(static_cast<double>(curr_number))+1; int buf_step; buf_step=0; while(easy_numbers[buf_step]<sq_root) if (curr_number%easy_numbers[buf_step++]!=0) continue; else goto g1; break; g1: } easy_numbers.push_back(curr_number); step++; } return curr_number; } int main() { int K; int L=-1; cin >> K; if (K==4) {cout << 3; exit(0);} easy_numbers.push_back(3); int buf=0; while((easy_numbers[buf]*easy_numbers[buf])<=K) next_number(++buf); for (int i=0;i<easy_numbers.size();i++) { if (K%easy_numbers[i]==0) {L=easy_numbers[i]-1; break;}
} if (L==-1 && K%2==0) {L=K/2-1; cout << L; exit(0);} if (L==-1) {L=K-1; cout << L; exit(0);} cout << L; return 0; } |
| Weak tests | Fyodor Menshikov | 1297. Palindrome | 10 Nov 2009 14:04 | 4 |
Please add test aa I know AC solution that answers to this test 'a'. why right answer 'a' and not 'aa'? |
| I know how to do it now! | Зане | 1627. Join | 10 Nov 2009 12:58 | 1 |
We can use Matrix-Tree theoremd(生成树计数) to solve it! O(N^3) |
| !!! use "seekeof" instead of "eof" | cqyzzzl | 1001. Reverse Root | 10 Nov 2009 12:38 | 1 |
have a try. { while not seekeof begin end; } |
| Does the order in which you print the word matters? | Prabhjot Singh | 1002. Phone Numbers | 10 Nov 2009 02:35 | 2 |
Does the order in which you print the word matters? |
| Help me with 5th test. | Basmus | 1200. Horns and Hoofs | 10 Nov 2009 00:19 | 5 |
I cannot pass thru 5th test. Edited by author 06.10.2004 20:05 TEST #5 Vlad Veselov [PMG17, Vinnitsa - KNU, Kiev] 6 Oct 2004 20:05 input--> 5434.87 -4567 300 correct output--> 1540461.00 300 0 Re: TEST #5 Иксанов Семён Александрович 8 Oct 2004 18:10 where do you get an input tests? |
| About Test #11 | PPLoveTT | 1315. MDPAR and MIIAR | 9 Nov 2009 21:36 | 3 |
What's the trick on Test #11?.. Help me ... I also need some help... It seems to me, that my program is correct. Got AC finally. In 11 test N=1000; M=1000; D=1998; X=1000; Y=1; Rescue operation required; start position in water. My mistake was, that I didn't fill with water start position of bfs. |
| I don't know why I got ac. | 衣衣是我的全部,我爱衣衣 | 1226. esreveR redrO | 9 Nov 2009 19:20 | 5 |
I have writen the program if many similar ways. I don't know why I got ac with this program: const u : set of char = ['A'..'Z','a'..'z']; var s : string; i : integer; ch : char; begin s := ''; while not (eof) do begin read(ch); if ch in u then s := ch+s else begin write(s); write(ch); s := ''; end; end; if ch in u then write(s); end. by the way, the pascal program should use "read(char)" instead "readln(string)" or you will get crash! Yeah, I don't know, either. I think it sure will be WA. may be all the words are palindromes:) All right. Because s +'abc' will give "sabc", and 'abc' + s will give "abcs". |
| connected iff sharing point | Koala | 1281. River Basin | 9 Nov 2009 10:22 | 1 |
two rivers are considered to be connected iff they share at least one vertex (no matter inner vertex or end vertex) example 1: 2 2 -1 0 1 0 2 0 1 0 -1 not connected, because their intersection (0, 0) is not a vertex of river 1 or river 2 example 2: 2 2 -1 0 1 0 3 0 1 0 0 0 -1 not connected, because (0, 0) is not a vertex of River 1 example 3: 2 3 0 1 0 0 0 -1 3 -1 0 0 0 1 0 connected, because (0, 0) appears on both rivers |
| Tricks are! | svr | 1730. ManBearPig | 9 Nov 2009 09:04 | 3 |
After 3 test use a/b=>(a/nod(a,b))/(b/nod(a,b)) To the English reader it will be not clear. It is necessary to write GCD. |
| Two dimensional interval tree | typedef | | 9 Nov 2009 05:24 | 3 |
Hello. I have an array of numbers from 1 to N. The order is random. I have to answer a lot(M) of questions like: how many numbers from interval [x, y] bigger than k. I tried to build two-dimensional interval tree: each edge of interval tree has an internal tree. But that tree was too large. 1 <= N, M <= 100000 Memory limit = 64 Mb Also I tried to build Fenwick tree. But it also needs too much memory: O(N^2). Please, can you help me to compress an interval tree or Fenwick tree? Or, maybe, there is another way to solve this problem? Thank you. You can store in each node of interval tree sorted list of numbers in corresponding interval. It requires O(n log n) memory and can be built in O(n log n) time (you can merge two sorted lists in linear time). With this tree you can answer queries in O(log^2 n) time using binary search Edited by author 10.11.2009 02:42 Thank you! It really works :) |
| WA 18 | Sergiy_PMI_31 [Lviv NU] | 1730. ManBearPig | 9 Nov 2009 03:52 | 1 |
WA 18 Sergiy_PMI_31 [Lviv NU] 9 Nov 2009 03:52 I still have WA on test 18 after many efforts. Does anyone know some tricks about this test? My program gives right answers on all my tests. Can anyone give me more tests? |
| Sample | Oracle[Lviv NU] | 1308. Dean's Pyramid | 9 Nov 2009 02:14 | 1 |
Sample Oracle[Lviv NU] 9 Nov 2009 02:14 Shouldn't the answer to the sample be 0.3660? I've solved this problem assuming, that pyramid lies on triangular edge. It seems to me that it is wrong suggestion, nevertheless it got AC. It seems to me, that pyramid should be firstly rotated to lay on one of the triangular face - then the answer is 0.3660. Am I wrong? Edited by author 09.11.2009 02:17 |