Common BoardSOLVED Edited by author 17.10.2017 00:37 using System; namespace SMSSpam { class Program { static void Main(string[] args) { string spam = Console.ReadLine(); Console.WriteLine(spamPrice(spam.ToLower())); Console.ReadKey(); } static int spamPrice (string spam) { int price = 0; foreach (char letter in spam) { price += LetterPrice(letter); } return price; } static int LetterPrice (char letter) { string charSet = "abcdefghijklmnopqrstuvwxyz*.,! "; return (charSet.IndexOf(letter) % 3) + 1; } } } got WA3. have any test examples to help? Edited by author 16.10.2017 20:02 This test helped me: 1 AAA AA Saturday 3 You must sort the missing cards' number in increasing order. This test helped me on WA14: 10 4 1 1 2 10 Answer: 1 2 3 If you think it in a way of dynamic programming it could help. Imagine we have N pirats. Calculate probability of draw for single round (either all N pirats has the same gesture or there's a pirat for every possible gesture). Then calculate average number of rounds to be played before someone lost (standard geometric sum). Now someone is lost and we have the same game but with less pirats. So we can use DP-approach with probabilities. Use doubles, it's enough to get AC. You would be happy to implement this problem (my impl is 30 lines with i/o on c++). I just used some identities and solved some equations to get the answer. Pretty sure I wouldn't be able to solve if I did not have access to the net and that is pretty lame :/ Was anybody able to solve by deriving the solution themselves? If yes, then please share! I want to learn the approach! ^_^ Nice problem. Playing out with small numbers and sample could help in sequence instantiation. My solution is only 30 lines of c++ code O(L) though. Hint: imagine we have sequence which can replace up to L spaces afterall. Then to enlarge our sequence we insert L/2 + 1 in the beginning. Maximum L could be computed via straightforward iteration starting from lax max_L Example: seq: 2 max_L: 2 seq: 2, 2/2 + 1 = 2, 2 max_L: 2, 4 seq: 2, 2, 4/2 + 1 = 2, 2, 3 max_L: 2, 4, 10 seq: 2, 2, 3, 10/2 + 1 = 2, 2, 3, 6 max_L: 2, 4, 10, 40 Etc. GL. people! who has any ideas? What about test 13? What is test ??!?!?! Check if the plate fits in the tray I check plate if in tray but WA 13 !!! people! who has any ideas? Do you found test or reason for WA 25? I also had that problem but when I checked if big plate is placed in tray (2 * r > b here r is the radius of cone at the height d (d < h) and b is small side of tray). But now I have wa on test31 good luck I also had that problem but when I checked if big plate is placed in tray (2 * r > b here r is the radius of cone at the height d (d < h) and b is small side of tray). But now I have wa on test31 good luck Thanks. I can add, that we must check: 0 <= x + r && x + r <= w && 0 <= x - r && x - r <= w && 0 <= y + r && y + r <= h && 0 <= y - r && y - r <= h; for both plate x,y - coordinates of plate center's, r - minimal radius of plate, w,h - max(a,b), min(a,b) Test: 2 10 1 1 3 1 3 2 Ans: NO Edited by author 17.10.2010 03:31thanks your test helped me a lot. Thanks again I've read all the advice: my code meets all of them. Any other suggestions on WA25? Maybe someone is ready to look at my code? My e-mail is in my info. Thanks for any help. I made a stupid mistake while reading the input data. First I read bottom sides and then top sides. Surprisingly, this solution bring me to WA25 and half-an-hour debugging. It turned out I had read data in the same wrong manner and also got WA25! MAK, your advice was the most useful in this discussion )) Edited by author 17.10.2010 03:39 Yes! It was a very stupid mistake! I checked if radius of plates on the height d is not greater than a and not grater than b. But I should check their diameter instead it! This fact costed me 13 fail submissions... Try this test: 9 15 1 1 2 1 5 1 Answer is NO. Why NO? First (d=2)koord: 2 2 Second (d=5) koord: 4 10 I think YES, but WA 25... This test helped me on WA25: 20 28 1 1 2 11 12 1 Answer: NO. Can anyone explain why this is saying wrong answer? namespace Ex2 { class Program { static void Main(string[] args) { string[] input = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); for (int a = input.Length - 1; a >= 0; a--) { double temp = Math.Sqrt(double.Parse(input[a])); if (temp == 0) { string zero = temp.ToString(); zero += ","; Console.WriteLine(zero.PadRight(6,'0')); } else { Console.WriteLine(temp); } } //Console.ReadLine(); } } } How many input lines are declared in the task? How many input lines in the example? How many lines your program expects? import java.util.Scanner; public class main { public static void main(String[] args) throws Exception { Scanner scan = new Scanner(System.in); String a = scan.nextLine(); double b = Double.parseDouble(a); double c; double d = b; double mass[] = new double[(int)b]; while (b != 0) { c = Math.sqrt(scan.nextDouble()); mass[(int)(b - 1)] = c; b--; } for (double i = 0; i < d; i++) { System.out.printf("%.4f\n", mass[(int)i]); } } } Outputs "Runtime error" Edited by author 09.10.2017 00:50 Please look at example, try to find count of inputs you are reading into b. You can build binary tree Left child corresponds to inward fold Right child corresponds to outward fold Root is unfolded strip Build tree from root to leaves and before going deeper check winning conditions How to deal with case like this ' ' like ' like ' like ' like ' 'like ' it can be splitted as ( ) & ( like ' like ' like ' 'like ) or ( ' like ) & ( like ' like ' 'like ) or ( ' like ' like ) & ( like ' 'like ) or ( ' like ' like ' like ) & ( 'like ) Can you clarify this statement Inner entrance of apostrophe symbol (ASCII 39) into string or template is encoded by double apostrophe symbol And if it's true the case ''hi'' like ''hi'' will be changed to '"hi'' like '"hi' Am I right? Then how is this case possible? '''''' like '_''' The apostrophe symbol (ASCII 39) if appear in string or template will be double (now it becomes 2 successive apostrophe symbols). The English problem statement is wrong to me since it made us think that ASCII 39 is replaced by ASCII 34 or something. But in fact, ASCII 39 is replaced by two ASCII 39. At least, I got AC after using my above interpretation. Does anyone know about test number 8?. If you do, please upload some, thank you very much. I believe the test is simple. I had WA #8 and the only problem I had I forgot to initialize first vertix to RED color. Test: 1 0 result:0 #include <stdio.h> int main() { int a,b; scanf("%d,%d",&a,&b); printf("a+b=%d\n",a+b); return 0; } Don't print unnecessarily information like "a+b=" please, how can I get test cases on this oj? Error in jury solution was fixed, all test answers updated, few new tests added. Most authors lost their AC. Big thanks to the Winger for pointing out an issue and helping with fixing it. What error was fixed,maybe my code has the same error?? oh yeah Accepted.. with guess,and #include <bits/stdc++.h> using namespace std; int main() { int a, a2, a3; int b, b2, b3; scanf("%d %d %d %d %d %d", &a, &b, &a2, &b2, &a3, &b3); int bb1 = a - a3; int bb2 = b - b2; printf("%d %d\n", bb1, bb2); return 0; } #include<stdio.h> #include<math.h> #include<stdlib.h> #define SIZE 128*1024 int main() { int i,n=0; long long int num[SIZE],N; printf("enter your aray value:\n"); while(scanf("%lld",&N)!=EOF) { num[n]=N; n++; } for(i=n-1;i>=0;i--){
printf("%0.4lf\n",(double)sqrt(num[i])); } return 0; } ohhh...thanks for your great suggestion. |
|