ScienceGuy's blog

By ScienceGuy, history, 6 years ago, In English

I am trying to sort vector of points (pairs of integers) by the polar angle in counter-clockwise order around the first entry of the vector. I get wrong output, but can't find the problem in the code. I will appreciate it if you point out what I'm doing wrong. Here is my code: https://pastebin.com/mn6jZgyF

Full text and comments »

  • Vote: I like it
  • -8
  • Vote: I do not like it

By ScienceGuy, history, 7 years ago, In English

Hi, can you please tell me the solution for this problem? http://codeforces.com/gym/101147/problem/E

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it

By ScienceGuy, history, 7 years ago, In English

What is the efficient algorithm to find the maximum Greatest Common Divisor of N numbers? Input: First line contains N (2<=N<=10^5). Next line contains N numbers, each of them more than 1 and less than 10^5, output: Output the largest GCD of any pair of numbers.

Full text and comments »

  • Vote: I like it
  • -2
  • Vote: I do not like it

By ScienceGuy, history, 7 years ago, In English

http://codeforces.com/gym/101306/problem/D Here is an easy problem, but I get WA on test 6. Can you please tell me how to solve it or what I'm doing wrong? I guess that the "Martian to English" alphabet must be figured out from the test case examples (they include all of the 26 letters, uppercase and lowercase). So I put them in a 'map' and then print the answers, which is correct for the examples, but not for the 6th test. Here is my code: https://pastebin.com/sCZJnLZB

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By ScienceGuy, history, 7 years ago, In English

Hi, I just began using Python 3.6.1 for Codeforces problems. Codeforces allows us to submit code in Python 3.5.2, so I wonder if my solutions in 3.6.1 might still get accepted. I solved this easy problem: http://codeforces.com/gym/101341/problem/M
Please, tell me what I'm doing wrong, here is my code (which runs well on my computer, but gets runtime error when I submit): https://pastebin.com/NPs7HbkK

Full text and comments »

  • Vote: I like it
  • +3
  • Vote: I do not like it

By ScienceGuy, history, 7 years ago, In English

Hi, I just solved a problem "Fency Fence" (problem: http://codeforces.com/problemset/problem/270/A). My solution is as follows: 1. Create the set of the angles, which have an integer value and are the angles of regular polygons (size of polygons: min 3, maximum 100,000, because after that the angle alpha satisfies the next condition: 179 < alpha < 180); 2. Check if the input angle is in our set and output YES or NO based on this. Finished. Link of my submission: http://codeforces.com/contest/270/submission/25210820 My code got accepted, but it made me think of a different kind of problem: what if the input was a double? How would you solve it? Is there a special mathematical property to calculate the angle of an arbitrary regular polygon?

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By ScienceGuy, history, 7 years ago, In English

Here is the problem I solved: http://codeforces.com/problemset/problem/765/A). I submitted a code (My code: http://pastebin.com/8FckK356 ). It gives WA on test 11 (test 11: http://pastebin.com/g7MC6YJf ). But in my computer I paste the test and it outputs the correct result. The logic in my code is correct. So why does the CodeForces judge output a different result for my code?

Full text and comments »

  • Vote: I like it
  • -25
  • Vote: I do not like it