|
|
Common BoardTry to increase your EPS, I got AC with EPS = 1e-7 Somehow I managed to get AC without EPS. That's pretty weird since I was using acos. %) Test : abcdefgh Answer : dbacfeg Is this answer correct? no, correct answer is "cbdafegh" May answer be a floating point number? "телефонный разговор с женой длится полминуты." Or I should to round answer? Sorry, I understand what does this statement mean. Edited by author 23.05.2012 16:33 Too easy and fun problem :) deque + map = Accepted. I got WA at #1, but I've tested for thousands of kbs of files and I don't know why I'm wrong at all. Would you please show me why I got WA,please!! Help. What's wrong in this code? using System; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int N, A, B; do { Console.Write("ВВедите N: "); N = int.Parse(Console.ReadLine()); } while (N < 1 || N > 100); do { A = int.Parse(Console.ReadLine()); } while (A < 1 || A > 100); do { B = int.Parse(Console.ReadLine()); } while (B < 1 || B > 100);
int R = ((A*B) * 2)*N; Console.WriteLine(R); } } } > Console.Write("ВВедите N: "); Delete this line. You should not output anything except the answer. Just think how the system can check it otherwise? I deleted that line, but I still get the Crash on the first test((( All three numbers are given in the same line. So, when you try to parse it as a single number, it crashes. Any idea why I could get WA 4 ? All the tests I gave were ok. Edited by author 16.04.2010 23:25 try this '-' like '[a-b]' maybe it should be no. I got ac just modified it. somebody show some tests to me plz I know how to solve this problem,but I want to use the BigInteger of Java,could someone help me deal with it? email : ysymyth@gmail.com What kind of help do you need? BigIntegers' usage is very simple, I think. Just remember they are immutable, so if you need something like a += b use a = a.add(b) and not just a.add(b). could you send me a sample of using java bignumber? I'm new to java. Hi,guys. This problem is quite interesting for me and I'd like to solve it, but, truth to tell, I don't know how... :( I know that the problem relates to the graph theory, but I can't figure out what the problem of the graph theory this problem represents and what algorithms can be applied here. So, could you give me some little hint how to solve the problem?... Please..... Thank you very much for the info. Finally, I've got AC :)(It turned out to be a very easy problem). However, I still don't understand why this problem relates to the graph theory... Edited by author 25.11.2011 15:35 Hmm. I used BFS to solve this problem, for example #include <iostream> using namespace std; int main() { unsigned long long n,m; cin>>n>>m; if(m>=n) cout<<2*(n-1)<<endl; if(n>m) cout <<2*(m-1)+1<<endl; return 0; } Orz...My solution is so complex... You can even simpler)) #include <iostream> using namespace std; int main() { unsigned long long iN, iM; cin >> iN >> iM; cout << min(2 * (iN - 1), 2 * (iM - 1) + 1); return 0; } You don't really need unsigned long long. Got AC with unsigned int. linear time input + O(nlogn) time sorting + O(n)time availability checking gives ac in .015 sec and 150 kb. I think better solution is possible. Please, let me know. Use Hash Sort which is O(n) My AC solution doesn't use any cool algorithmes; just one formula. try a test where first player wins Help, give me test,please. My code,it worked for every test, but WA6: #include "iostream" #include "stdio.h" #include "deque" #include "string" using namespace std; int main() { std::deque<char> deq(0);
std::string line; std::getline(std::cin, line); for (int i= 0; i < line.size(); i++) { deq.push_back (line[i]); } deque<char>::size_type sz = deq.size(); for (int i=0; i<sz; i++) { if (i+1 != sz) { if (deq[i] == deq[i+1]) { deq.erase(deq.begin()+i,deq.begin()+(i+2)); if (i>0) i -=2; sz = deq.size(); continue; } } else if ((i-1)!=-1) { if (deq[i-1] == deq[i]) { deq.erase(deq.begin()+i-1,deq.begin()+(i+1)); if (i>0) i -=2; sz = deq.size(); continue; } } } for (int i=0; i<deq.size(); i++) cout << deq[i]; cout << endl; return 0; } I have use the structure of pointer for save the values . . . But I get answer access violation ??? But why??? Maybe, you are allocating too few memory? Brute force algo is just 4^5 actions. So, you can don't think about logical solution :) He-he, I could not understand how to solve it by bruteforce algo, because my bruteforce doesnt't pass some tests :) Logical algo is very simple. Edited by author 02.06.2012 15:45 Brute force algo can be done in 2^4 steps and works. Hmm, my logical algo takes also 16 operations. Four iterations of cycle with four operations in each iteration. Edited by author 30.06.2012 21:04 I used someone about Sieve of Eratosthenes to seach a number)))) For example, I got WA19 at first time. I changed real to extended and integer to longint and got AC. Use pi = 3.141592654 or like this: float const pi = 4.f * atanf(1.f); You don't need double precision to get AC Edited by author 29.06.2012 18:44 When say about this this is write correctly. St._Petersburg_SU and St._Petersburg_SU_of_ITMO is not same!!!!!!!!!!!! Sorry, for my ENGLISH Edited by author 04.03.2012 01:44 Edited by author 04.03.2012 01:44 Edited by author 04.03.2012 01:45 Nobody said that they are the same university. You just don't understand the sample. |
|
|