Общий форум| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения | | What is the point? | jagatsastry | 1352. Простые числа Мерсенна | 13 фев 2010 22:40 | 2 | If the only method possible is cheating, what is the point in giving such problems. It doesnt test anything. So, after you cheat it, you can get to know - what is it, Mersenne primes cos I, for example, don't know what is it before reading this problem =) | | Problem in condition! For admins. | [SESC USU] Zhirov Eugene | 1352. Простые числа Мерсенна | 13 фев 2010 22:36 | 1 | In the first string of condition: "For example, 2^2−1 — the first Mersenne prime". So, the first Mersenne prime is 2^2-1 = 3. Then, in the sample we read: 18 - 3217 But, if so, the first Mersenne prime is 2, not 3, so, for the test 1 1 the program should output 2, not 3. | | WA 7 why? | zslwyuan | 1295. Бред | 13 фев 2010 17:07 | 1 | var sum,ans,a,b,c,a1,b1,c1,n:longint; i,j:longint; begin readln(n); sum:=1;ans:=0;a:=2;b:=3;c:=4;a1:=1;b1:=1;c1:=1; for i:=1 to n do begin a1:=a1*a; a1:=a1 mod 1000; b1:=b1*b; b1:=b1 mod 1000; c1:=c1*c; c1:=c1 mod 1000; end; sum:=sum+a1+b1+c1; while sum<>0 do begin if sum mod 10=0 then inc(ans); sum:=sum div 10; end; writeln(ans); end. | | Incorrect Russian statement | Fyodor Menshikov | 1316. Биржа | 13 фев 2010 11:46 | 3 | Rus: Покупатели заявляют цену, по которой они готовы купить (от 0.01 до 10000.00 бибриков). Eng: Customers make their bids: announce a price at which they are ready to buy a pig (the price is between 0.01 and 10000.00 bibriks and always has exactly 2 digits after the decimal point). There is no analog of "and always has exactly 2 digits after the decimal point" in Russian statement which significantly complicate solution. | | help please | Felagund | 1309. Искусство спора | 13 фев 2010 02:03 | 2 | Can you please tell me is this array correct {0,5392,1890,84,6520,3149,2416,2835,80,8614,742,7696,6823, 9492,7710,9444,510,118,6522,3213,4499,6178,4565,763,1071, 8875,2688,9145,1211,9480,4056,1817,8661,5467,3358,2892, 2205,8691,1963,2386,8401,1047,3691,6824,825,7728,6797,1720 8194,9901,2823,1952,9344,5022,1421,6116,4511,1289,2133, 7494,7298,5012,9638,8753,5968,4029,4804,9556,924,1497,5886 6078,2085,3876,268,2910,8962,2970,1015,3931,1103,4872,4054 346,1119,931,4454,6530,1722,4266,9888,7961,2891,885,4461, 7731,3316,2155,93,2871,9710} q[i]=f(i*10^6),i from 0 to 100 Edited by author 18.12.2006 12:52 Edited by author 18.12.2006 12:53 Your array is like to be correct. But without good calculation of g(x,y) he is useless :) I wrote this function and get the SAME array. But my interval was 500 000 . It's avoid me to get TLE 17 on Java :) | | Why WA21?? | nikenny | 1727. Магические числа Знайки | 12 фев 2010 21:15 | 2 | Please, give me tests in which answer is "-1" | | i'm going mad. why my program gets WA1? | TereshinVS Liceum#165 | 1030. Титаник | 12 фев 2010 20:35 | 1 | import java.util.*; import java.text.*; public class zad1030 { public static void main(String[] args) { double alpS1, alpS2, alpD1, alpD2, l, r=6875/2.0, a, b, c; String s, res, sh="0123456789"; Scanner cin=new Scanner(System.in); NumberFormat f=NumberFormat.getInstance(Locale.UK); f.setMinimumFractionDigits(2); f.setMaximumFractionDigits(2); while (cin.hasNext()) { cin.nextLine(); cin.nextLine(); cin.nextLine(); s=cin.nextLine(); while (sh.indexOf(s.substring(0, 1))<0) { s=s.substring(1); } a=Integer.parseInt(s.substring(0, s.indexOf("^"))); s=s.substring(s.indexOf("^")+1); b=Integer.parseInt(s.substring(0, s.indexOf("'"))); s=s.substring(s.indexOf("'")+1); c=Integer.parseInt(s.substring(0, s.indexOf("\""))); s=s.substring(s.indexOf("\"")+1); alpS1=Math.toRadians(a+b/60.0+c/3600.0); if (s.substring(0, 3)==" SL") alpS1=-alpS1; s=cin.nextLine(); while (sh.indexOf(s.substring(0, 1))<0) { s=s.substring(1); } a=Integer.parseInt(s.substring(0, s.indexOf("^"))); s=s.substring(s.indexOf("^")+1); b=Integer.parseInt(s.substring(0, s.indexOf("'"))); s=s.substring(s.indexOf("'")+1); c=Integer.parseInt(s.substring(0, s.indexOf("\""))); s=s.substring(s.indexOf("\"")+1); alpD1=Math.toRadians(a+b/60.0+c/3600.0); if (s.substring(0, 3)==" WL") alpD1=-alpD1; cin.nextLine(); s=cin.nextLine(); while (sh.indexOf(s.substring(0, 1))<0) { s=s.substring(1); } a=Integer.parseInt(s.substring(0, s.indexOf("^"))); s=s.substring(s.indexOf("^")+1); b=Integer.parseInt(s.substring(0, s.indexOf("'"))); s=s.substring(s.indexOf("'")+1); c=Integer.parseInt(s.substring(0, s.indexOf("\""))); s=s.substring(s.indexOf("\"")+1); alpS2=Math.toRadians(a+b/60.0+c/3600.0); if (s.substring(0, 3)==" SL") alpS2=-alpS2; s=cin.nextLine(); while (sh.indexOf(s.substring(0, 1))<0) { s=s.substring(1); } a=Integer.parseInt(s.substring(0, s.indexOf("^"))); s=s.substring(s.indexOf("^")+1); b=Integer.parseInt(s.substring(0, s.indexOf("'"))); s=s.substring(s.indexOf("'")+1); c=Integer.parseInt(s.substring(0, s.indexOf("\""))); s=s.substring(s.indexOf("\"")+1); alpD2=Math.toRadians(a+b/60.0+c/3600.0); if (s.substring(0, 3)==" WL") alpD2=-alpD2; l=r*Math.acos(Math.sin(alpS1)*Math.sin(alpS2)+Math.cos(alpS1)*Math.cos(alpS2)*Math.cos(alpD1-alpD2)); l=Math.round(l*100)/100.0; res=f.format(l); System.out.println("The distance to the iceberg: "+res+" miles."); if (100.0-l>=0.01) System.out.println("DANGER!"); cin.nextLine(); } } } Edited by author 12.02.2010 21:06 | | Can somebody give me some hints on how to solve P1056? | abc | 1056. Центры сети | 12 фев 2010 20:09 | 7 | 1. the graph forms a tree 2. you need to give this tree direction (since the given tree is undirected) 3. the longest path starting at node k is the maximum of 2 values: the maximum path starting at k and going DOWN (a tree has no cycles so you can solve this easily in linear time, i used simple DP) and the maximum path by going UP from k. "the maximum path by going UP from k." What do you mean by this? How to calculate the maximum path by going up from k Just invert directions of all edges and calculate the maximum path by going DOWN form k. Realization of this thing is much easier than its description. Just cut off leafs of tree step by step while count of nodes >2! Edited by author 25.06.2005 14:44 Far not the fastest solution, but passed (0.375 sec): 1. make a bidirectional graph, connectivity of which will be kept in an array of vectors 2. start dfs from each of the verticies which are not leaves and calculate the longest path 3. Note that if there are 2 vertices, the answer is always "1 2" The solution might run in O(N*(N+M)) time, as I guess Edited by author 15.02.2010 13:13 Edited by author 15.02.2010 13:13 | | C++ Compilation error | Hatred | 1245. Картины | 12 фев 2010 16:40 | 1 | Looks like std::vector::rend() does not return const_reverse_iterator. I have got CE on the line for( std::vector< Spot >::const_reverse_iterator it = spots.rbegin(); it != spots.rend(); ++it ) but for( std::vector< Spot >::/*const_*/reverse_iterator it = spots.rbegin(); it != spots.rend(); ++it ) was ok. | | Перезагрузка операторов | adam+ | | 12 фев 2010 11:37 | 1 | Здраствуйте! Задача: Написать такой класс А, чтобы данный фрагмент кода компилировался и работал. А a1; A a2=a1+2+A(3); Код: # include <iostream> using namespace std; class A{ private: int x; public: A():x(0){};//Constructor A(int y):x(y){}; A(const A & y) //Copy constructor { x=y.x; return *this; } A operator+(A y) const;
};
A A::operator+(A y) const{ return A(x+y.x); }
int main()
{ A a1; A a2=a1+2+A(3); return 0; }
| | WA 6 | unlucky [Vologda SPU] | 1261. Чаевые | 12 фев 2010 02:38 | 1 | WA 6 unlucky [Vologda SPU] 12 фев 2010 02:38 | | Why WA 2 | Ildar | 1001. Обратный корень | 12 фев 2010 02:06 | 1 | Hi. #include<iostream> #include<math.h> #include<iomanip> using namespace std; int main(){ int i=0; double *a=new double[8000000]; double c; while(cin.eof()==false){ cin>>c; a[i]=sqrt(c); i++; } i--; i--; while(i>=0){ cout<<setprecision(4000)<<a[i]<<'\n'; i--; } return 0; } WA 2. Why? | | what to output if N=1 | teamSaratov | 1261. Чаевые | 11 фев 2010 21:58 | 5 | can anyone please tell me what to output if N=1 is given? well, when I added to code: if N=1 then begin writeln('0'); halt; end; I've got WA on test 1. With out such code I've got WA on test 7. So, test 1 - N=1. But I'm not sure in correct solution: my program outputs 4 3. But 4 can be got only like: 4 = 1 + 3; So, then change is already included in paying. Smth strange, don't you think so? I had WA1 with output 0 for N=1. With 4 3 I passed 1st test but failed with WA9 which is something like 12 or 81. So, amount of tips must be POSITIVE. Edited by author 01.08.2008 00:48 why when n=1 answer 4 3? i think it must be 3 2!! 2 can't be representeted of sum numbers(3^n, where every N can be used _1 time_). | | Some Hints... to solve this problem | Nurtayev Elmurod | 1236. Decoding Task | 11 фев 2010 11:20 | 2 | input1 : 05 26 2C 52 69 14 3F 31 4C 2A 69 65 1A 26 4B input2 : 61 07 28 41 3B 63 07 2C 52 22 21 69 72 0B 42 5E answer : 41 43 4D 20 49 43 50 43 20 4E 45 45 52 43 27 32 (P.S : I put the spaces only for that is easy to read && understand) Why is first 2 bytes in answer is 41...? Cuz, 61h xor 20h = 41h (20h -> 32d = ' ' = Space); How to find the second,third,...? 41h xor 05h = 44h 44h xor 07h = 43h(Second 2 bytes); 43h xor 26h = 65h 65h xor 28 = 4Dh (Third 2 bytes); Last some tips: if you use algos for convert from Dec to Hex be careful; your algo should convert 1 : 0d to 00h (not to 0h); 2 : 5d to 05h (not to 5h); GoodLuck!!! ;-) Edited by author 17.05.2009 08:41 | | Test 4 (Special Characters) | Varun Sharma | 1153. Суперкомпьютер | 10 фев 2010 23:15 | 2 | Hi, To those who are reading the input character by character, test 4 contains some Non Digit characters as well like new line or space at the end of input etc. In my program, I just put a condition to ignore those and then it worked fine. Varun Thank you VERY much! :-) Edited by author 10.02.2010 23:16 | | Why BFS got WA on #8 | duancanchao | 1072. Маршрутизация | 10 фев 2010 18:42 | 3 | Maybe you can show me your code? And weren't you training for the National Day last night? strange.. Edited by author 06.09.2009 17:24 me too! i have found it! check if your code is longint or int64 Edited by author 10.02.2010 19:05 | | 2 admins! | Alexander Samal | 1005. Куча камней | 10 фев 2010 18:08 | 3 | I found this test on acmp.ru 21 1 16 11 5 18 21 My AC answer was 3 but real is 1 (21+21+5=47 && 18+16+11+1=46 => 47-46=1) Really, my AC give 2 =( Edited by author 08.01.2010 02:33 | | is this output right for the sample input? | namiheike | 1077. Travelling Tours | 10 фев 2010 15:51 | 3 | My friend,I got AC. Maybe you should find connected components at first | | why wrong at test3?c++ | Boqian Jiang | 1001. Обратный корень | 10 фев 2010 03:48 | 2 | i run it and i see there's no differernce between mine and the accepted one in result. #include <cstdlib> #include <iostream> #include <cmath> #include <iomanip> using namespace std; int main(int argc, char *argv[]) { int a=0; double b[1000];
do{ cin>>b[a]; b[a]=sqrt(b[a]); a++;} while (!cin.eof());
a=a-2;
while (a>=0) { cout<<setiosflags(ios::fixed)<<setprecision(4); cout<<b[a]<<endl; a--; }
system("PAUSE"); return EXIT_SUCCESS; } http://acm.timus.ru/help.aspx?topic=faq&locale=enHow to read and write data? Programs should read and write data using standard input and output, i.e. should read from the keyboard and write to the screen. Programs must not work with files, it may cause “Restricted function” verdict. You should not add statements like Readln or !!!pause()!!! to the end of your programs. Such things may cause “Time limit exceeded” verdict. | | how to use C in this Problem | silictool | 1001. Обратный корень | 10 фев 2010 03:45 | 2 | |
|
|