Блог пользователя ScienceGuy

Автор ScienceGuy, история, 6 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

Автор ScienceGuy, история, 7 лет назад, По-английски
  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

Автор ScienceGuy, история, 7 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

Автор ScienceGuy, история, 7 лет назад, По-английски

http://codeforces.net/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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор ScienceGuy, история, 7 лет назад, По-английски

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.net/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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор ScienceGuy, история, 8 лет назад, По-английски

Hi, I just solved a problem "Fency Fence" (problem: http://codeforces.net/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.net/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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор ScienceGuy, история, 8 лет назад, По-английски

Here is the problem I solved: http://codeforces.net/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?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -25
  • Проголосовать: не нравится