Skip to content

Instantly share code, notes, and snippets.

@Amar1729
Created January 27, 2019 02:35
Show Gist options
  • Save Amar1729/9b3916396d0497c3102b768611fee024 to your computer and use it in GitHub Desktop.
Save Amar1729/9b3916396d0497c3102b768611fee024 to your computer and use it in GitHub Desktop.
FB-2018-hackercup 1: python and jelly solution
Ɠ‘©
ɠø¢¡ø®’Ḃ
“`ȥ)øỊm»ø“6I»ø¢ø?
“ŒXɗ?»;⁸;“M»;¢
ƓRÇ€Y
# find the number of times a line intercepts with the x axis based on its highest power
# because of certain constraints in the problem, the line will intercept once if the
# power is odd, and not at all if an even power.
# note - run the corresponding jelly file:
# jelly fun interception.jelly < interception_example_input.txt
st = "Case #{}: {}"
def calc():
n = int(input())
garbage = [input() for _ in range(0, n+1)]
return "1\n0.0" if n%2 else "0"
for i, _ in enumerate(range(0, int(input()))):
print(st.format(i+1, calc()))
Case #1: 1
0.0
Case #2: 0
Case #3: 0
Case #4: 1
0.0
Case #5: 1
0.0
Case #6: 1
0.0
Case #7: 1
0.0
Case #8: 0
Case #9: 0
Case #10: 0
Case #11: 1
0.0
Case #12: 0
Case #13: 1
0.0
Case #14: 0
Case #15: 1
0.0
Case #16: 0
Case #17: 1
0.0
Case #18: 1
0.0
Case #19: 1
0.0
Case #20: 0
Case #21: 0
Case #22: 1
0.0
Case #23: 1
0.0
Case #24: 0
Case #25: 1
0.0
Case #26: 1
0.0
Case #27: 0
Case #28: 0
Case #29: 0
Case #30: 1
0.0
Case #31: 1
0.0
Case #32: 0
Case #33: 1
0.0
Case #34: 1
0.0
Case #35: 0
Case #36: 0
Case #37: 0
Case #38: 1
0.0
Case #39: 1
0.0
Case #40: 1
0.0
Case #41: 0
Case #42: 1
0.0
Case #43: 1
0.0
Case #44: 0
Case #45: 1
0.0
Case #46: 1
0.0
Case #47: 1
0.0
Case #48: 0
Case #49: 1
0.0
Case #50: 1
0.0
Case #51: 1
0.0
Case #52: 0
Case #53: 1
0.0
Case #54: 1
0.0
Case #55: 1
0.0
Case #56: 1
0.0
Case #57: 1
0.0
Case #58: 0
Case #59: 1
0.0
Case #60: 1
0.0
Case #61: 0
Case #62: 1
0.0
Case #63: 1
0.0
Case #64: 1
0.0
Case #65: 1
0.0
Case #66: 0
Case #67: 0
Case #68: 0
Case #69: 1
0.0
Case #70: 0
Case #71: 1
0.0
Case #72: 1
0.0
Case #73: 0
Case #74: 0
Case #75: 1
0.0
Case #76: 1
0.0
Case #77: 0
Case #78: 1
0.0
Case #79: 0
Case #80: 0
Case #81: 1
0.0
Case #82: 1
0.0
Case #83: 0
Case #84: 0
Case #85: 0
Case #86: 1
0.0
Case #87: 1
0.0
Case #88: 1
0.0
Case #89: 0
Case #90: 0
Case #91: 1
0.0
Case #92: 0
Case #93: 0
Case #94: 0
Case #95: 0
Case #96: 0
Case #97: 1
0.0
Case #98: 1
0.0
Case #99: 0
Case #100: 1
0.0
Case #101: 1
0.0
Case #102: 1
0.0
Case #103: 0
Case #104: 1
0.0
Case #105: 0
Case #106: 1
0.0
Case #107: 0
Case #108: 0
Case #109: 1
0.0
Case #110: 1
0.0
Case #111: 1
0.0
Case #112: 1
0.0
Case #113: 1
0.0
Case #114: 1
0.0
Case #115: 1
0.0
Case #116: 0
Case #117: 1
0.0
Case #118: 1
0.0
Case #119: 0
Case #120: 1
0.0
Case #121: 1
0.0
Case #122: 1
0.0
Case #123: 0
Case #124: 0
Case #125: 0
Case #126: 0
Case #127: 0
Case #128: 1
0.0
Case #129: 0
Case #130: 0
Case #131: 0
Case #132: 1
0.0
Case #133: 0
Case #134: 1
0.0
Case #135: 1
0.0
Case #136: 0
Case #137: 1
0.0
Case #138: 0
Case #139: 0
Case #140: 1
0.0
Case #141: 0
Case #142: 1
0.0
Case #143: 0
Case #144: 0
Case #145: 0
Case #146: 0
Case #147: 1
0.0
Case #148: 0
Case #149: 1
0.0
Case #150: 1
0.0
Case #151: 1
0.0
Case #152: 1
0.0
Case #153: 1
0.0
Case #154: 0
Case #155: 0
Case #156: 1
0.0
Case #157: 0
Case #158: 1
0.0
Case #159: 0
Case #160: 1
0.0
Case #161: 0
Case #162: 1
0.0
Case #163: 0
Case #164: 1
0.0
Case #165: 0
Case #166: 0
Case #167: 1
0.0
Case #168: 1
0.0
Case #169: 1
0.0
Case #170: 0
Case #171: 1
0.0
Case #172: 1
0.0
Case #173: 1
0.0
Case #174: 0
Case #175: 0
Case #176: 0
Case #177: 1
0.0
Case #178: 1
0.0
Case #179: 0
Case #180: 0
Case #181: 0
Case #182: 0
Case #183: 0
Case #184: 0
Case #185: 1
0.0
Case #186: 1
0.0
Case #187: 1
0.0
Case #188: 1
0.0
Case #189: 1
0.0
Case #190: 1
0.0
Case #191: 0
Case #192: 0
Case #193: 1
0.0
Case #194: 1
0.0
Case #195: 1
0.0
Case #196: 1
0.0
Case #197: 0
Case #198: 1
0.0
Case #199: 0
Case #200: 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment