Общий форумfor N, ####...N/2times ####...N/2 times consider first half N/2 digits sum(digit root) will always be from 0 to 9 it will be 0 only if all digits are 0's and it'll will 1,2,3 .... ,9 in other cases... for N=4 first half will have 2 digits ( total 100 numbers ) 1 number(00) will have digit root = 0 99 numbers will have digit root other than 0 ( i.e 11 numberes --> digit root 1 , 11 numbers ---> digit root 2 etc ) so for N=4 , case i : first half = 00 second half =00 -----> n1 = 1 case ii: first half --> 99 ways , second half --> 11 ways n2= 99*11 total number = n1+n2 = 99*11 + 1 similarly for N=6 , we have 999*111 + 1 N=8 , 9999*1111 + 1 so on... Do not use BigInteger to calculate. Let k = n/2, then the result is 10 for k=1; otherwise it is a concatenation of "1"x(k-1), "0", "8"x(k-2), and "90": 1 10 2 1090 3 110890 4 11108890 5 1111088890 6 111110888890 7 11111108888890 8 1111111088888890 9 111111110888888890 Mine quite straightforward realization works about 1 sec. and uses almost 60 megabytes of memory. Please, give an idea how to solve it more quickly... Edited by author 17.03.2010 14:10 Input french string "Administrateurs" and compaire it with english string "Administrators". Expected result: True Sample code: string a = Environment.UserName; if (a.Equals("Administrator",StringComparison. CurrentCultureIgnoreCase)) { Console.WriteLine("Good"); } output: Good Anyone with the same WA? I think Java is starting to be the problem... Is there a trick? I must forget something, because i tried 3 different implementations for finding the current convex hull of the points, and all three get WA 10... What does you program output on the following test: 3 0 0 1 1 2 2 ? What does you program output on the following test: 3 0 0 1 1 2 2 ? 0 It's ok. Try this: 8 0 0 0 1 0 2 1 0 1 2 2 0 2 1 2 2 It's ok. Try this: 8 0 0 0 1 0 2 1 0 1 2 2 0 2 1 2 2 1 :) Is there a chance, you looked at my code? It's not so long, and I'll put some comments. If you don't want to get involved, I'll understand :) Ok, send it to nick[youknowwhat]inbox[youknowwhatagain]ru, using goryinyich instead of nick message is sent, thank you in advance! Received. But I'll have time to look at it only in saturday-sunday... Your code gets WA on the following test: 33 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 -1 1 -2 2 -3 3 -4 4 -5 5 -6 6 -7 7 -8 8 -9 9 -10 10 -11 11 0 -1 0 -2 0 -3 0 -4 0 -5 0 -6 0 -7 0 -8 0 -9 0 -10 0 -11 By the way, even if you correct the error, it will get TLE: for the test generated by the following Pascal code you program doesn't finish the job in 1 minute: var i, n: integer; begin n := 1333; rewrite (output, 'input.txt'); writeln (3*n); for i := 1 to n do writeln (i , ' ', i); for i := 1 to n do writeln (-i , ' ', i); for i := 1 to n do writeln (0 , ' ', -i); end. AC atlast :) Thanks man, I had 2 big problems, but all fixed with +10 lines code. Thank you for great test! Hey how did you solve the TLE? nevermind.. .acos takes a looot of time Question removed Edited by author 15.03.2010 03:09 что это за ошибка может кто сказать что она значит Hi, I got WA at test #3. I have applied all of the samples above to the algorithm and the program output the correct result. Any body can help me? I meant by above to the samples in the last posts. Here are some tests that helped me pass test number 3: Input: 8 2 4 1 7 0 0 2 3 4 6 6 Output: 2 Input: 10 2 4 1 5 0 1 4 7 8 Output: 3 Input: 20 20 2 1 1 0 Output: 0 Here are some tests that helped me pass test number 3: Input: 8 2 4 1 7 0 0 2 3 4 6 6 Output: 2 Input: 10 2 4 1 5 0 1 4 7 8 Output: 3 Input: 20 20 2 1 1 0 Output: 0 first and second tests are not correct. Worms cross themself. Edited by author 14.03.2010 03:51i divide n numbers into ceil[n/a] segments for each segment, increasing B's ties by add b until it reach a, and count the pairs. such like this: while(j + b <= a) { ans += j * b; j += b; } it use %I64d but not %lld If there is cycle in graph then -1, if path from S to T does not exist then -1, else 1. My Ac prog gives 2 on 10 11 1 10 1 5 5 10 5 1 1 2 2 3 3 4 4 2 4 7 7 8 8 7 8 10 By the way. Answer may be ~ 50000 Also: To find all circles is very difficult. To find strong components: this is helped me to break long sequence of TLE Can you give an idea of solution with StrConnected Comp? You must take in account that only 26 TopCoders has solved this probem. It rather involved and demand education level. For your training only I can said: 1. If stronng comp is not simple circle and can be go in from s and after t is achivebale then: -1 2. If only simple circles we met then: it's number mines one. it is coin change asymptotics. I'd say if the path from S to T does not exist then we should output 0. I wonder why the solution with Arithmetic progression is impossible. a:=a+b c:=c-d ... ... and several times isn't that equals to a:=a+bx and c:=c-dx ?? Because they can stop after a:=a+b c:=c-d ... ... a:=a+b It equals to a:=a+bx c:=c-d(x-1) Edited by author 13.03.2010 01:16 Mods, send input data for test1 please. Trying to solve the problem second day already. Thx vanvector@mail.ru Why the Sample Output is 3? BIG is wrong, yes? It must be 6! I don't understand the meaning! This sentence iz correkt! -It Has,No mista;.Kes et oll. But there are two BIG mistakes in this one! and here is one more. Mistakes: 1). "I" in second line 2). "G" in second line 3). "a" in third line I don't see another mistakes, do you see? Thank you! I know now. I thought if the first letter in the word is 'A'-'Z' is wrong! How foolish I am! Thank you very much! Edited by author 03.06.2004 17:42 If you want my program, email this: trz322@hotmail.com How about "-It Has,No mista;.Kes et oll." "Has" is it mistake? Why "has" in upper case if it isn't first letter?? What's wrong in my program? I can't find mistake. Anybody knows it? #include<fstream> #include<iostream> #include<cstdio> using namespace std; long n, m; __int64 x, y = 0, n1; int main (){ cin >> n >> m; n1 = 3*n; for (int i = 0; i < m; ++i){ cin >> x; y+=x; if (y >= n1){ cout << "Free after " << i+1 << " times."; return 0; } } cout << "Team.GOV!"; return 0; } I have the same problem. Algorithm: //----------------------------------------------- #include<stdio.h> void main(void){ int exit,goes,i,sum=0; int sums[3000]; bool free=false; scanf("%d %d",&exit,&goes); exit*=3; for(i=0;i<goes;i++) scanf("%d",&sums[i]);
for(i=0;i<goes;i++) { sum+=sums[i]; if(sum>=exit) {free=true; break;} } if(free==true) printf("Free after %d times.",i+1); else printf("Team.GOV!"); } //---------------------------------------------- Wrong answer, test No.3 your mistakes are very simple - guy's spent money should overwhelm (not equal!) n. Is there somewhere a list with the restricted functions for Java? B can be greater than A Good Luck ^^ N'Pong Thx for your hint. from P'Moo Edited by author 07.01.2007 11:30 Thx a lot! but why goods at moderate price cost higher than "high price" good? I don't care for value of b :) What I must print if sample input 1 5 1 2 3 4 5 Give me some hints please you can use dynamic programming Please, tell me how to dp? I just use a heap. Edited by author 18.08.2006 19:22 Sort by finish time. For every delivery do: if current delivery time is greater than the number of already scheduled deliveries, schedule it; else (that is, it is equal), replace the least important scheduled delivery with this one. Altogether O(n log(n)). Edited by author 10.03.2010 18:40 Edited by author 10.03.2010 18:40 |
|