# | User | Rating |
---|---|---|

1 | Um_nik | 3459 |

2 | tourist | 3438 |

3 | maroonrk | 3359 |

4 | ecnerwala | 3347 |

5 | Benq | 3317 |

6 | ksun48 | 3309 |

7 | boboniu | 3300 |

8 | Petr | 3293 |

9 | Radewoosh | 3289 |

10 | TLE | 3223 |

# | User | Contrib. |
---|---|---|

1 | Errichto | 206 |

2 | Monogon | 194 |

3 | SecondThread | 191 |

4 | pikmike | 187 |

5 | antontrygubO_o | 186 |

6 | vovuh | 185 |

7 | Ashishgup | 181 |

8 | Um_nik | 180 |

9 | Radewoosh | 169 |

10 | pashka | 167 |

You're given a number **$$$n$$$** It may be prime or not, It's required from you to get 4 positive prime numbers at which their summition equals to **$$$n$$$**, and if this isn't possible, then state that (There's more that one test cast BTW).

My approach was to get all prime numbers form **2** to **10000000** using sieve theory only once, and to try assume 3 of these numbers and get every possible combination of 2's and 3's (Assuming that all prime numbers can be deduce from summition of these two) let these numbers are **$$$x$$$**, **$$$y$$$** and **$$$z$$$** and if there exist a fourth number at which this 4th number = `n - x + y + z`

and If it's positive and prime, then we found the answer otherwise this won't be possible.

If there's something wrong with my approach? If not there's the mistake in my code Link to the problem is here

Two friends Kunal and Satyam are playing an interesting game. They take turns drawing a ball from a bag which initially contains R red balls and G green balls. Each player draws a ball alternatively and never put it back. The person who is the first to draw a red balls wins. Satyam always draws first. If there are no more balls in the bag and nobody has drawn a red ball, the satyam wins.

Input -----

The first line will contain the number of test cases T. The first line of each test case will contain a number R (number of red balls) and G(number of green balls )

Cases:

2 1 --> 0.6666667 1 1 ---> 0.50000 10 0 ----> 1.0000

problem link is here:

I tired to solve the problem using top-bottom approach but my codes gives wrong answer at the last case (0 instead of 1)

```
int probability = 0, c = 0;
void magic(int red, int green, int turn){
if(green == -1 || red == -1)return ;
if(red == 0){
probability++;
if(turn % 2 == 0) c++;
return ;
}
if(turn == -1) turn = 0;
else turn++;
magic(red, green-1, turn % 2);
magic(red-1, green, turn % 2);
return ;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(nullptr);
int q;
cin >> q;
while(q--){
int x, y;
cin >> x >> y;
magic(x, y, -1);
cout << fixed << setprecision(9) << c * 1.0 / probability << '\n';
probability = 0, c = 0;
}
return 0;
}
```

I will appreciate any kind of help from all of you, and thanks for your time

When I enter my submission page and click in my submission IDs, It doesn't work with me, and so when I enter a problem like and click on my submissions the "Click here to see details" doesn't work too!

- Another problem, I have submittied a problem called CME form yesterday and It got accepted at 31 ms and now I submitted the same exact code and got accepted at 46 ms!

Does someone else have the same Issue as mine?

Hi everyone,

This problem gives you two inputs N, M and N contains a number like (123) and all what you have to do is to add some digits on the left or the right of the (123) to make it divisible by M Hint about solving this problem, Or a solution for It?

constrains :- ** N<= 10^12** and

Sample tests:-

(Test 1) 1 2 ===> 10 (Test 2) 2 11 ===> 22 (Test 3)234 823 ===> 12345

problem link: https://www.urionlinejudge.com.br/judge/en/problems/view/2788

And thanks In advance. :)

I has been 6 months since I start to solve problems from any online judge (Codeforces was the first one by the way) but since then, I barely notice a difference in my problem solving skills from now and 6 months ago even I had solve +100 problem and every time I register in a contest (div 2 or 3), my rate always decreases by -90 or more, and even If I managed to solve a problem It would be an A only.

So what should I do to improve my self even more? or begin a professional problem-solver requires lot of years practising? I'll be very grateful If you recommeded a few solutions based on your experience ^^

Thanks in advance.

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/21/2020 16:06:40 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|