submission_id
string
problem_id
string
status
string
code
string
input
string
output
string
problem_description
string
s273490293
p00009
Runtime Error
import sys n=10**5 p=[1]*n p[0],p[1]=0,0 for i in xrange(2,int(n**0.5)+1): if p[i]==1: for j in xrange(i**2,n,i): p[j]=0 for i in xrange(2,n): p[i]+=p[i-1] for line in sys.stdin.readlines(): print p[int(line)]
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s499220680
p00009
Runtime Error
import sys def f(n): li = [x for x in range(2,n+1)] pr = [] while True: pr.append(li[0]) li = [x for x in li if x%li[0]!=0] if li[-1]<pr[-1]**2: return pr+li for n in sys.stdin: print len(f(int(n)))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s752816637
p00009
Runtime Error
import math def get_primes(max_number):#return prime list smaller than max_number if max_number == 2: return [2] elif max_number < 3: return [] numbers=range(1, max_number + 2, 2) nroot=math.floor(max_number ** 0.5) n=len(numbers) numbers[0]=0 for i in range(1, n): x = numbers[i] if x > nroot: break if x and i + x < n: for j in range(i+x,n+1,x): numbers[j] = 0 x=[2] + filter(None, numbers[1:]) return x n=[] i=0 while (True): try: n.append([i,input(), 0]) i+=1 except: break n=sorted(n, key=lambda x: x[1]) for i, e in enumerate(get_primes(n[-1][1])): for j in range(len(n)): if e<=n[j][1]: n[j][2]+=1 n=sorted(n, key=lambda x: x[0]) for e in n: print e[2]
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s003345443
p00009
Runtime Error
import sys for line in sys.stdin: count = 0 n = int(line) nums = range(2, n+1) while True: if len(nums) == 1: count += 1 break else: count += 1 nums = [ for x in nums[1:] if x % nums[0] != 0 ] print count
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s988187479
p00009
Runtime Error
import sys for line in sys.stdin: count = 0 n = int(line) nums = range(2, n+1) while True: if len(nums) == 1: count += 1 break else: count += 1 m = nums[0] numsCandidate = [1:] nums = [ for x in numsCandidate if x % m != 0 ] print count
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s157717712
p00009
Runtime Error
import sys for line in sys.stdin: count = 0 n = int(line) nums = range(2, n+1) while True: if len(nums) == 0: break if len(nums) == 1: count += 1 break else: count += 1 m = nums[0] numsCandidate = nums[1:] nums = [ for x in numsCandidate if x % m != 0 ] print count
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s216715347
p00009
Runtime Error
import math import sys nums = [1] * 1000000 nums[:2] = [0,0] cnt = 0 while cnt <= math.sqrt(n): flg = nums[cnt] if flg == 1: k = 2 while k*cnt <= n: nums[k*cnt] = 0 k += 1 cnt += 1 for line in sys.stdin: n = int(line) print sum(nums[:n+1])
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s328361170
p00009
Runtime Error
#!/usr/bin/env python def get_pn(num, result): if num == 1: return result else: for i in range(2,num-1): if (num % i) == 0: break else: result.append(num) return get_pn(num-1, result) if __name__ == "__main__": while True: try: print len(get_pn(int(raw_input()),[])) except EOFError: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s102008727
p00009
Runtime Error
#!/usr/bin/env python def get_pn(num, result): if num == 1: return result else: for i in range(2,num-1): if (num % i) == 0: break else: result.append(num) return get_pn(num-1, result) if __name__ == "__main__": for i in range(30): try: print len(get_pn(int(raw_input()),[])) except EOFError: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s606990577
p00009
Runtime Error
#!/usr/bin/env python def get_pn(num, result): if (num == 1 or num == 0): return result else: for i in range(2,num-1): if (num % i) == 0: break else: result.append(num) return get_pn(num-1, result) if __name__ == "__main__": for i in range(30): try: print len(get_pn(int(raw_input()),[])) except EOFError: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s411382551
p00009
Runtime Error
#!/usr/bin/env python def get_pn(num, result): if (num <= 1): return result else: for i in range(2,num-1): if (num % i) == 0: break else: result.append(num) return get_pn(num-1, result) if __name__ == "__main__": for i in range(30): try: print len(get_pn(int(raw_input()),[])) except EOFError: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s135046721
p00009
Runtime Error
#!/usr/bin/env python def get_pn(num, result): if (num <= 1): return result else: for i in range(2,num): if (num % i) == 0: break else: result.append(num) return get_pn(num-1, result) if __name__ == "__main__": for i in range(30): try: print len(get_pn(int(raw_input()),[])) except EOFError: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s362151391
p00009
Runtime Error
def isPrime(num): flag = True for i in range(2, num): if num % i == 0: flag = False break return flag def countPrime(num): count = 0 for i in range(2, num+1): if isPrime(i): count += 1 return count if __name__ == '__main__': nums = [] for num in sys.stdin: nums.append(int(num)) for num in nums: print countPrime(num)
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s802963582
p00009
Runtime Error
import sys rand = random.randint def prime(n): if n == 2: return True if n < 2 or n & 1 == 0: return False return pow(2, n-1, n) == 1 a = [prime(i) for i in range(1000000)] for s in sys.stdin: i = int(s) print(a[:i+1].count(True))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s932853278
p00009
Runtime Error
import math ans = [] while True: try: n = int(raw_input()) isPrime = [-1] * (n + 1) isPrime[0], isPrime[1] = False, False i = 2 while i * i < n: for j in range(i, n+i, i): isPrime[j] = False isPrime[i] = True i = isPrime.index(-1) ans.append(isPrime.count(True) + isPrime.count(-1)) except EOFError: break for num in ans: print num
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s243087366
p00009
Runtime Error
while True: n = int(raw_input()) filter = [1 for i in range(n)] filter[0] = 0 for i in range(1:n): j = 2 while k < n: k = i*j filter[k-1] = 0 count = 0 do i in filter: sum += i print sum
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s242894424
p00009
Runtime Error
while True: try: n = int(raw_input()) filter = [1 for i in range(n)] filter[0] = 0 for i in range(1:n): j = 2 while k < n: k = i*j filter[k-1] = 0 j += 1 count = 0 do i in filter: sum += i print sum except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s650455368
p00009
Runtime Error
while True: while True: try: n = int(raw_input()) filter = [1 for i in range(n)] filter[0] = 0 for i in range(2,n//2): j = 2 k = i*j while k < n: filter[k-1] = 0 j += 1 k = i*j print filter sum = 0 for i in filter: sum += i print sum except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s103520941
p00009
Runtime Error
while True: try: n = int(raw_input()) filter = [1 for i in range(n)] filter[0] = 0 for i in range(2,n//2):        if filter[i] = 1 j = 2 k = i*j while k < n: filter[k-1] = 0 j += 1 k = i*j print filter sum = 0 for i in filter: sum += i print sum except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s245054720
p00009
Runtime Error
while True: try: n = int(raw_input()) filter = [1 for i in range(n)] filter[0] = 0 for i in range(2,n//2):        if filter[i] == 1: j = 2 k = i*j while k < n: filter[k-1] = 0 j += 1 k = i*j print filter sum = 0 for i in filter: sum += i print sum except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s749105086
p00009
Runtime Error
while True: try: n = int(raw_input()) filter = [1 for i in range(n)] filter[0] = 0 for i in range(2,n//2):      if filter[i] == 1: j = 2 k = i*j while k < n: filter[k-1] = 0 j += 1 k = i*j print filter sum = 0 for i in filter: sum += i print sum except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s641878696
p00009
Runtime Error
import math r = 999999 sqrt = int(math.sqrt(r)) prime = [1 for i in range(r)] prime[0] = 0 for i in range(2,r/2): prime[2*i-1] = 0 for i in range(3,sqrt,2): for j in range(2*i,r,i) prime[j] = 0 while True: try: n = int(raw_input()) print sum(prime[:n]) except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s096343074
p00009
Runtime Error
import math r = 999999 sqrt = int(math.sqrt(r)) prime = "1"*r prime[0] = 0 for i in range(2,r/2): prime[2*i-1] = 0 for i in range(3,sqrt,2): for j in range(2*i,r+1,i): prime[j-1] = 0 while True: try: n = int(raw_input()) print sum(prime[:n]) except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s832941235
p00009
Runtime Error
import math r = 999999 sqrt = int(math.sqrt(r)) prime = "1"*r prime[0] = 0 for i in range(2,r/2): prime[2*i-1] = "0" for i in range(3,sqrt,2): for j in range(2*i,r+1,i): prime[j-1] = "0" while True: try: n = int(raw_input()) print sum(prime[:n]) except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s494548464
p00009
Runtime Error
import math r = 999999 sqrt = int(math.sqrt(r)) prime = "1"*r prime[0] = "0" for i in range(2,r/2): prime[2*i-1] = "0" for i in range(3,sqrt,2): for j in range(2*i,r+1,i): prime[j-1] = "0" while True: try: n = int(raw_input()) print sum(prime[:n]) except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s520063673
p00009
Runtime Error
----:---F1 *scratch* All L1 (Fundamental)------------------------------------------------------------------------------------ Loading subst-jis...done import math r = 999999 sqrt = int(math.sqrt(r)) p = [1 for i in range(r)] p[0] = 0 for i in range(1,sqrt): if p[i]: for j in range(2*(i+1)-1,r,i+1): p[j] = 0 while True: try: n = int(raw_input()) print sum(p[:n]) except: break
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s625227796
p00009
Runtime Error
import math while True: try: n.append(int(raw_input())) except: break r = max(n)+1 sqrt = int(math.sqrt(r)) p = [1]*r p[0] = 0 for i in range(1,sqrt): if p[i]: for j in range(2*i+1,r,i+1): p[j] = 0 for i in n: print sum(p[:i])
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s080727649
p00009
Runtime Error
import math n = [] while True: try: n.append(int(raw_input())) except: break r = max(n)+1 sqrt = int(math.sqrt(r)) p = [1]*r p[0] = 0 for i in range(1,sqrt): if p[i]: p[2*i+1::i+1] = range(2*i+1,r,i+1): for i in n: print sum(p[:i])
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s970051253
p00009
Runtime Error
import math n = [] while True: try: n.append(int(raw_input())) except: break r = max(n)+1 sqrt = int(math.sqrt(r)) p = [1]*r p[0] = 0 for i in range(1,sqrt): if p[i]: p[2*i+1::i+1] = [0 for range(2*i+1,r,i+1)]: for i in n: print sum(p[:i])
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s820984870
p00009
Runtime Error
import math n = [] while True: try: n.append(int(raw_input())) except: break r = max(n)+1 sqrt = int(math.sqrt(r)) p = [1]*r p[0] = 0 for i in range(1,sqrt): if p[i]: p[2*i+1::i+1] = [0 for range(2*i+1,r,i+1)] for i in n: print sum(p[:i])
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s383093190
p00009
Runtime Error
import math n = [] while True: try: n.append(int(raw_input())) except: break r = max(n)+1 sqrt = int(math.sqrt(r)) p = [1]*r p[0] = 0 for i in range(1,sqrt): if p[i]: p[2*i+1::i+1] = [0]*range(2*i+1,r,i+1) for i in n: print sum(p[:i])
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s060395458
p00009
Runtime Error
import sys ifprime = [1]*(1000000) ifprime[0] = ifprime[1] = 0 a = 2 while a <= num: if ifprime[a]: ans += 1 b = a*a while b <= num: ifprime[b] = 0 b += a a += 1 for n in sys.stdin: print sum(ifprime[:int(n)])
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s702221446
p00009
Runtime Error
import math val = [] max_prime = 0 while True: num = int(raw_input()) tmp = [i+1 for i in range(1, num)] x = math.sqrt(num) if len(val) != 0: max_prime = val[-1] tmp = tmp[max_prime-1:] print tmp for i in tmp: if i > x: break for j in range(2,num): if i*j > num: break if i*j in tmp: tmp.remove(i*j) val += tmp[len(val):] print val print max_prime print len(tmp)
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s455093910
p00009
Runtime Error
def isPrime(p): if p == 2: return 1 if p < 2 or p&1 == 0: return 0 return 1 if pow(2,p-1,p) == 1 else 0 n = int(raw_input()) print sum(isPrime(int(i) for i in range(1,n+1))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s567473364
p00009
Runtime Error
def isPrime(p): if p == 2: return 1 if p < 2 or p&1 == 0: return 0 return 1 if pow(2,p-1,p) == 1 else 0 while True: try: n = int(raw_input()) print sum(isPrime(i) for i in range(1,n+1))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s578211264
p00009
Runtime Error
# coding: utf-8 import sys import math if __name__ == '__main__': input_list = sys.stdin.readlines() for num in input_list: target_number = int(num.replace('\n', '')) serial_number_list = [r for r in range(2, target_number + 1)] multiple_list = [] while math.sqrt(target_number) >= serial_number_list[0]: serial_number = serial_number_list[0] i = 1 multiple_list.append(serial_number) while target_number >= serial_number * i: if serial_number * i in serial_number_list: serial_number_list.pop(serial_number_list.index(serial_number * i)) i += 1 print(multiple_list)
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s588522487
p00009
Runtime Error
# coding: utf-8 import sys import math if __name__ == '__main__': input_list = sys.stdin.readlines() for num in input_list: target_number = int(num.replace('\n', '')) serial_number_list = [r for r in range(2, target_number + 1)] multiple_list = [] while math.sqrt(target_number) >= serial_number_list[0]: serial_number = serial_number_list[0] i = 1 multiple_list.append(serial_number) while target_number >= serial_number * i: if serial_number * i in serial_number_list: serial_number_list.pop(serial_number_list.index(serial_number * i)) i += 1 print(multiple_list + serial_number_list)
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s737736396
p00009
Runtime Error
# coding: utf-8 import sys import math if __name__ == '__main__': input_list = sys.stdin.readlines() for num in input_list: target_number = int(num.replace('\n', '')) serial_number_list = [r for r in range(2, target_number + 1)] multiple_list = [] while math.sqrt(target_number) >= serial_number_list[0]: serial_number = serial_number_list[0] i = 1 multiple_list.append(serial_number) while target_number >= serial_number * i: if serial_number * i in serial_number_list: serial_number_list.pop(serial_number_list.index(serial_number * i)) i += 1 print(len(multiple_list + serial_number_list))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s541923543
p00009
Runtime Error
import math def sieve_of_erastosthenes(target_list): for num in target_list: input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True sqrt = math.sqrt(num) for serial in range(3, num, 2): if serial >= sqrt: print(sum(input_list)) break for s in range(serial ** 2, num, serial): input_list[s] = False if __name__ == '__main__': target_list = [] while True: try: target_list.append(int(input())) except: break sieve_of_erastosthenes(target_list)
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s169099360
p00009
Runtime Error
import math def sieve_of_erastosthenes(num): input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True sqrt = math.sqrt(num) for serial in range(3, num, 2): if serial >= sqrt: # print([i for i, b in enumerate(input_list) if b == True]) return sum(input_list) for s in range(serial ** 2, num, serial): input_list[s] = False if __name__ == '__main__': while True: try: n = int(input()) except: break print(sieve_of_erastosthenes(n))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s598956866
p00009
Runtime Error
import math def sieve_of_erastosthenes(num): input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True sqrt = math.sqrt(num) for serial in range(3, num, 2): if serial >= sqrt: return input_list for s in range(serial ** 2, num, serial): input_list[s] = False if __name__ == '__main__': while True: try: n = int(input()) except: break input_list = sieve_of_erastosthenes(n) print(sum(input_list))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s326236620
p00009
Runtime Error
import math def sieve_of_erastosthenes(num): if 2 >= num: return 1 input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True sqrt = math.sqrt(num) for serial in range(3, num, 2): if serial >= sqrt: return input_list for s in range(serial ** 2, num, serial): input_list[s] = False if __name__ == '__main__': while True: try: n = int(input()) except: break input_list = sieve_of_erastosthenes(n) print(sum(input_list))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s988089281
p00009
Runtime Error
import math def sieve_of_erastosthenes(num): input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True sqrt = math.sqrt(num) for serial in range(3, num, 2): if serial >= sqrt: return input_list for s in range(serial ** 2, num, serial): input_list[s] = False if __name__ == '__main__': while True: try: n = int(input()) except: break if 2 >= n: print(1) else: input_list = sieve_of_erastosthenes(n) print(sum(input_list))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s963301506
p00009
Runtime Error
input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True sqrt = math.sqrt(num) for serial in range(3, num, 2): if serial >= sqrt: return input_list if input_list[serial] is True: for s in range(serial ** 2, num, serial): input_list[s] = False
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s772256971
p00009
Runtime Error
def sieve_of_erastosthenes(num): input_list = [False if i % 2 == 0 or i % 3 == 0 or i % 5 == 0 else True for i in range(num)] input_list[0] = input_list[1] = False input_list[2] = input_list[3] = input_list[5] = True for serial in range(3, int(num ** 0.5) + 1, 2): if input_list[serial] is True: for s in range(serial ** 2, num, serial): input_list[s] = False # print([i for i, b in enumerate(input_list) if b == True]) return sum(input_list) if __name__ == '__main__': while True: try: n = int(input()) except: break print(sieve_of_erastosthenes(n))
10 3 11
4 2 5
<H1>Prime Number</H1> <p> Write a program which reads an integer <var>n</var> and prints the number of prime numbers which are less than or equal to <var>n</var>. A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. </p> <H2>Input</H2> <p> Input consists of several datasets. Each dataset has an integer <var>n</var> (1 &le; <var>n</var> &le; 999,999) in a line. </p> <p> The number of datasets is less than or equal to 30. </p> <H2>Output</H2> <p> For each dataset, prints the number of prime numbers. </p> <H2>Sample Input</H2> <pre> 10 3 11 </pre> <H2>Output for the Sample Input</H2> <pre> 4 2 5 </pre>
s684815146
p00010
Wrong Answer
import math def run(): n = int(input()) epsilon = 1e-16 for _ in range(n): x1, y1, x2, y2, x3, y3 = list(map(float, input().split())) u1 = (x1-x3)*(x2-x1)*(x3-x2) u2 = (x2-x1)*(y3-y2)*(y3+y2) u3 = (x3-x2)*(y2-y1)*(y2+y1) v = x1*x2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 + x3*y2 Py = (-u1 + u2 - u3) / (v + epsilon) / 2 Px = (x2**2 - x1**2 + y2**2 - y1**2 - (y2 - y1)*Py) / ((x2-x1) + epsilon) / 2 r = math.sqrt((Px-x1)**2 + (Py-y1)**2) print('{0:.3f} {1:.3f} {2:.3f}'.format(round(Px,3), round(Py,3), round(r,3))) if __name__ == '__main__': run()
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s222758979
p00010
Wrong Answer
import math def run(): n = int(input()) epsilon = 1e-16 for _ in range(n): x1, y1, x2, y2, x3, y3 = list(map(float, input().split())) u1 = (x1-x3)*(x2-x1)*(x3-x2) u2 = (x2-x1)*(y3-y2)*(y3+y2) u3 = (x3-x2)*(y2-y1)*(y2+y1) v = x1*x2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 + x3*y2 Py = (-u1 + u2 - u3) / v / 2 Px = (x2**2 - x1**2 + y2**2 - y1**2 - (y2 - y1)*Py) / (x2-x1 + epsilon) / 2 r = math.sqrt((Px-x1)**2 + (Py-y1)**2) print('{0:.3f} {1:.3f} {2:.3f}'.format(round(Px,3), round(Py,3), round(r,3))) if __name__ == '__main__': run()
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s351598737
p00010
Wrong Answer
import math def run(): n = int(input()) epsilon = 1e-20 for _ in range(n): x1, y1, x2, y2, x3, y3 = list(map(float, input().split())) u1 = (x1-x3)*(x2-x1)*(x3-x2) u2 = (x2-x1)*(y3-y2)*(y3+y2) u3 = (x3-x2)*(y2-y1)*(y2+y1) v = x1*x2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 + x3*y2 Py = (-u1 + u2 - u3) / v / 2 Px = (x2**2 - x1**2 + y2**2 - y1**2 - (y2 - y1)*Py) / (x2-x1 + epsilon) / 2 r = math.sqrt((Px-x1)**2 + (Py-y1)**2) print('{0:.3f} {1:.3f} {2:.3f}'.format(round(Px,3), round(Py,3), round(r,3))) if __name__ == '__main__': run()
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s247585288
p00010
Wrong Answer
import math def run(): n = int(input()) epsilon = 1e-40 for _ in range(n): x1, y1, x2, y2, x3, y3 = list(map(float, input().split())) u1 = (x1-x3)*(x2-x1)*(x3-x2) u2 = (x2-x1)*(y3-y2)*(y3+y2) u3 = (x3-x2)*(y2-y1)*(y2+y1) v = x1*x2 + x2*y3 + x3*y1 - x1*y3 - x2*y1 + x3*y2 Py = (-u1 + u2 - u3) / v / 2 Px = (x2**2 - x1**2 + y2**2 - y1**2 - (y2 - y1)*Py) / (x2-x1 + epsilon) / 2 r = math.sqrt((Px-x1)**2 + (Py-y1)**2) print('{0:.3f} {1:.3f} {2:.3f}'.format(round(Px,3), round(Py,3), round(r,3))) if __name__ == '__main__': run()
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s987058212
p00010
Wrong Answer
# -*- coding: utf-8 -*- import cmath class Point(object): def __init__(self, x, y): self.point = complex(x, y) def __str__(self): return "x = {0}, y = {1}".format(self.point.real, self.point.imag) class Triangle(Point): def __init__(self, a, b, c): self.a = a self.b = b self.c = c # 3辺の長さ self.edgeA = abs(b.point-c.point) self.edgeB = abs(c.point-a.point) self.edgeC = abs(a.point-b.point) # 3角の大きさ self.angleA = Triangle.angle(self.edgeA, self.edgeB, self.edgeC) self.angleB = Triangle.angle(self.edgeB, self.edgeC, self.edgeA) self.angleC = Triangle.angle(self.edgeC, self.edgeA, self.edgeB) # 角度を求める def angle(A, B, C): return cmath.acos( (B*B+C*C-A*A)/(2*B*C) ) # 外接円の半径 def circumscribedCircleRadius(self): return abs((self.edgeA/cmath.sin(self.angleA))/2) # 外心 def circumscribedCircleCenter(self): A = cmath.sin(2*self.angleA) B = cmath.sin(2*self.angleB) C = cmath.sin(2*self.angleC) X = (self.a.point.real*A + self.b.point.real*B + self.c.point.real*C) / (A+B+C) Y = (self.a.point.imag*A + self.b.point.imag*B + self.c.point.imag*C) / (A+B+C) return complex(X, Y) n = int(input()) for i in range(n): line = list(map(float, input().split())) p1 = Point(line[0], line[1]) p2 = Point(line[2], line[3]) p3 = Point(line[4], line[5]) T = Triangle(p1, p2, p3) center = T.circumscribedCircleCenter() print("{0:.4f} {1:.4f} {2:.4f}".format(center.real, center.imag, T.circumscribedCircleRadius()))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s768955444
p00010
Wrong Answer
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys def calc_det(lis): return lis[0]*lis[3]-lis[1]*lis[2] def sq(x): return x*x for s in sys.stdin: d = map(float, s.split() ) if len(d) == 1: continue x1,y1,x2,y2,x3,y3 = d[0],d[1],d[2],d[3],d[4],d[5] d11 = 2*(x3-x2) d12 = 2*(y3-y2) d21 = 2*(x2-x1) d22 = 2*(y2-y1) x11 = sq(x3)-sq(x2)+sq(y3)-sq(y2) x21 = sq(x2)-sq(x1)+sq(y2)-sq(y1) y12 = x11 y22 = x21 x0 = calc_det( [x11,d12,x21,d22] )/calc_det( [d11,d12,d21,d22] ) y0 = calc_det( [d11,y12,d21,y22] )/calc_det( [d11,d12,d21,d22] ) r = ( (x0-x1)**2 + (y0-y1)**2 )**0.5 print "%.3f %.3f %.3f" % (x0,y0,r) ''' Bibliography 3点を通る円の半径を求む(#7) http://www.geocities.jp/jtqsw192/FIG/313r/3point_r.htm '''
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s717079295
p00010
Wrong Answer
# coding: UTF-8 # main.py n = map(int,raw_input().split()) for i in xrange(0,n[0]): x1,x2,x3,y1,y2,y3 = map(float,raw_input().split()) print x1
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s260481070
p00010
Wrong Answer
import sys f = sys.stdin def take2(iterable): while True: yield next(iterable), next(iterable) #外積 def cross(v1, v2): return v1.real * v2.imag - v1.imag * v2.real # 線分13と線分24の交点を求める def get_intersection(p1,p2,p3,p4): a1 = p4 - p2 b1 = p2 - p3 b2 = p1 - p2 s1 = cross(a1, b2) / 2 s2 = cross(a1, b1) / 2 print(s1,s2) return p1 + (p3 - p1) * s1 / (s1 + s2) n = int(f.readline()) for i in range(n): p1, p2, p3 = [x + y * 1j for x, y in take2(map(float, f.readline().split()))] p12 = (p1 + p2) / 2 p13 = (p1 + p3) / 2 pxy = get_intersection(p12,p13,p12 + (p2 - p1) * 1j,p13 + (p1 - p3) * 1j) r = abs(pxy - p1) print('{:.3f} {:.3f} {:.3f}'.format(pxy.real,pxy.imag,r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s876386317
p00010
Wrong Answer
import math for i in range(input()): x1,y1,x2,y2,x3,y3=map(float,raw_input().split(" ")) if y2==y1 or y3==y1: if y2==y1: a2=-(x3-x1)/(y3-y1) b2=((y3+y1)-a2*(x1+x3))/2.0 a,b,c,d,e,f=1.0,0.0,(x1+x2)/2.0,-a2,1.0,b2 else: a1=-(x2-x1)/(y2-y1) b1=((y2+y1)-a2*(x1+x2))/2.0 a,b,c,d,e,f=-a1,1.0,b1,1.0,0.0,(x1+x3)/2.0 else: a1=-(x2-x1)/(y2-y1) a2=-(x3-x1)/(y3-y1) b1=((y2+y1)-a1*(x1+x2))/2.0 b2=((y3+y1)-a2*(x1+x3))/2.0 a,b,c,d,e,f=-a1,1.0,b1,-a2,1.0,b2 py=(a*f-c*d)/(a*e-b*d) px=(c*e-f*b)/(a*e-b*d) r=math.sqrt((px-x1)**2 + (py-y1)**2) print "{0:.3f} {1:.3f} {2:.3f}".format(px,py,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s855654493
p00010
Wrong Answer
import math for i in range(input()): x1,y1,x2,y2,x3,y3=map(float,raw_input().split(" ")) if y2-y1 == 0. or y3-y1 == 0.: if y2-y1 == 0.: a2=-(x3-x1)/(y3-y1) b2=((y3+y1)-a2*(x1+x3))/2.0 a,b,c,d,e,f=1.0,0.0,(x1+x2)/2.0,-a2,1.0,b2 else: a1=-(x2-x1)/(y2-y1) b1=((y2+y1)-a2*(x1+x2))/2.0 a,b,c,d,e,f=-a1,1.0,b1,1.0,0.0,(x1+x3)/2.0 else: a1=-(x2-x1)/(y2-y1) a2=-(x3-x1)/(y3-y1) b1=((y2+y1)-a1*(x1+x2))/2.0 b2=((y3+y1)-a2*(x1+x3))/2.0 a,b,c,d,e,f=-a1,1.0,b1,-a2,1.0,b2 py=(a*f-c*d)/(a*e-b*d) px=(c*e-f*b)/(a*e-b*d) r=math.sqrt((px-x1)**2 + (py-y1)**2) print "{0:.3f} {1:.3f} {2:.3f}".format(px,py,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s989823390
p00010
Wrong Answer
def calc(l): A1=2*(l[1][0]-l[0][0]) B1=2*(l[1][1]-l[0][1]) C1=l[0][0]**2-l[1][0]**2+l[0][1]**2-l[1][1]**2 A2=2*(l[2][0]-l[0][0]) B2=2*(l[2][1]-l[0][1]) C2=l[0][0]**2-l[2][0]**2+l[0][1]**2-l[2][1]**2 X=round((B1*C2-B2*C1)/(A1*B2-A2*B1),3) Y=round((C1*A2-C2*A1)/(A1*B2-A2*B1),3) return X,Y l=[zip(*[iter(map(float,raw_input().split()))]*2) for i in range(input())] for ll in l: print "%.3f %.3f"%(calc(ll))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s761605204
p00010
Wrong Answer
# coding: utf-8 #Problem Name: Circumscrived Circle of a Triangle #ID: tabris #Mail: t123037@kaiyodai.ac.jp n = int(raw_input()) data = [0 for _ in range(n)] for i in range(n): data[i] = map(float,raw_input().split(' ')) for (x1,y1,x2,y2,x3,y3) in data: det = 4*x2*y3 - 4*y2*x3 if det != 0: px = ((x2**2 + y2**2)*2*y3 - (x3**2 + y3**2)*2*y2)/det if px == 0: px = 0. py = (2*x2*(x3**2 + y3**2) - 2*x3*(x2**2 + y2**2))/det if py == 0: py = 0. r = ((px-x1)**2 + (py-y1)**2)**.5 print '{0:.3f} {1:.3f} {2:.3f}'.format(px,py,r) else: print '0.000 0.000 0.000'
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s290063615
p00010
Wrong Answer
# coding: utf-8 #Problem Name: Circumscrived Circle of a Triangle #ID: tabris #Mail: t123037@kaiyodai.ac.jp n = int(raw_input()) for i in range(n): x1,y1,x2,y2,x3,y3 = map(float,raw_input().split(' ')) det = 4*x2*y3 - 4*y2*x3 if det != 0: px = ((x2**2 + y2**2)*2*y3 - (x3**2 + y3**2)*2*y2)/det if px == 0: px = 0. py = (2*x2*(x3**2 + y3**2) - 2*x3*(x2**2 + y2**2))/det if py == 0: py = 0. r = ((px-x1)**2 + (py-y1)**2)**.5 print '{0:.3f} {1:.3f} {2:.3f}'.format(px,py,r) else: print '0.000 0.000 0.000'
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s980608734
p00010
Wrong Answer
# coding: utf-8 #Problem Name: Circumscrived Circle of a Triangle #ID: tabris #Mail: t123037@kaiyodai.ac.jp def __det(matrix): return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0] def __sqdist(p1,p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)**.5 n = int(raw_input()) for i in range(n): x1,y1,x2,y2,x3,y3 = map(float,raw_input().split(' ')) det = __det([[(x1-x2),(y1-y2)],[(x1-x3),(y1-y3)]]) c1 = (x1**2-x2**2+y1**2-y2**2)/2 c2 = (x1**2-x3**2+y1**2-y3**2)/2 px = __det([[c1,(y1-y2)],[c2,(y1-y3)]])/det py = __det([[(x1-x2),c1],[(x1-x3),c2]])/det r = __sqdist([x1,x2],[px,py]) print '{0:.3f} {1:.3f} {2:.3f}'.format(px,py,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s793255293
p00010
Wrong Answer
# coding: utf-8 #Problem Name: Circumscrived Circle of a Triangle #ID: tabris #Mail: t123037@kaiyodai.ac.jp def __det(matrix): return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0] def __sqdist(p1,p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)**.5 n = int(raw_input()) for i in range(n): x1,y1,x2,y2,x3,y3 = map(float,raw_input().split(' ')) det = __det([[(x1-x2),(y1-y2)],[(x1-x3),(y1-y3)]]) c1 = (x1**2-x2**2+y1**2-y2**2)/2 c2 = (x1**2-x3**2+y1**2-y3**2)/2 if det != 0: px = __det([[c1,(y1-y2)],[c2,(y1-y3)]])/det py = __det([[(x1-x2),c1],[(x1-x3),c2]])/det else: px,py = 0.,0. r = __sqdist([x1,x2],[px,py]) print '{0:.3f} {1:.3f} {2:.3f}'.format(px,py,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s180849118
p00010
Wrong Answer
# coding: utf-8 #Problem Name: Circumscrived Circle of a Triangle #ID: tabris #Mail: t123037@kaiyodai.ac.jp def __det(matrix): return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0] def __sqdist(p1,p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)**.5 n = int(raw_input()) for i in range(n): x1,y1,x2,y2,x3,y3 = map(float,raw_input().split(' ')) det = __det([[(x1-x2),(y1-y2)],[(x1-x3),(y1-y3)]]) c1 = (x1**2-x2**2+y1**2-y2**2)/2 c2 = (x1**2-x3**2+y1**2-y3**2)/2 if det != 0: px = __det([[c1,(y1-y2)],[c2,(y1-y3)]])/det py = __det([[(x1-x2),c1],[(x1-x3),c2]])/det elif x1==x2==x3 and y1==y2==y3: px,py = x1,y1 else: if x1==x2: px = (x1+x3)/2 py = (y1+y3)/2 elif x1==x3: px = (x1+x2)/2 py = (y1+y2)/2 else: px = (x2+x3)/2 py = (y2+y3)/2 r = __sqdist([x1,x2],[px,py]) print '{0:.3f} {1:.3f} {2:.3f}'.format(px,py,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s606949430
p00010
Wrong Answer
# coding: utf-8 #Problem Name: Circumscrived Circle of a Triangle #ID: tabris #Mail: t123037@kaiyodai.ac.jp def __det(matrix): return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0] def __sqdist(p1,p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)**.5 n = int(raw_input()) for i in range(n): x1,y1,x2,y2,x3,y3 = map(float,raw_input().split(' ')) det = __det([[(x2-x1),(y2-y1)],[(x3-x1),(y3-y1)]]) c1 = (x2**2-x1**2+y2**2-y1**2)/2 c2 = (x3**2-x1**2+y3**2-y1**2)/2 px = __det([[c1,(y1-y2)],[c2,(y1-y3)]])/det py = __det([[(x1-x2),c1],[(x1-x3),c2]])/det r = __sqdist([x1,x2],[px,py]) print '{0:.3f} {1:.3f} {2:.3f}'.format(px,py,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s090429095
p00010
Wrong Answer
# coding: utf-8 #Problem Name: Circumscrived Circle of a Triangle #ID: tabris #Mail: t123037@kaiyodai.ac.jp def __det(matrix): return matrix[0][0] * matrix[1][1] - matrix[0][1] * matrix[1][0] def __sqdist(p1,p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)**.5 n = int(raw_input()) for i in range(n): x1,y1,x2,y2,x3,y3 = map(float,raw_input().split(' ')) det = __det([[(x2-x1),(y2-y1)],[(x3-x1),(y3-y1)]]) c1 = (x1**2-x2**2+y1**2-y2**2)/2 c2 = (x1**2-x3**2+y1**2-y3**2)/2 px = __det([[c1,(y1-y2)],[c2,(y1-y3)]])/det py = __det([[(x1-x2),c1],[(x1-x3),c2]])/det r = __sqdist([x1,x2],[px,py]) print '{0:.3f} {1:.3f} {2:.3f}'.format(px,py,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s288264777
p00010
Wrong Answer
def main(): import math while True: try: for i in range(int(input())): x1,y1,x2,y2,x3,y3=map(float,input().split()) a=y1-y2 b=y1-y3 if a==0: x=(x1+x2)/2 c=(x3-x1)/(y1-y3) d=(-x1-x3)/2+(y1+y3)/2 y=c*x+d elif b==0: x=(x1+x3)/2 c=(x2-x1)/(y1-y2) d=(-x1-x3)/2+(y1+y3)/2 y=c*x+d else: a=(x2-x1)/(y1-y2) b=(-x1-x2)/2+(y1+y2)/2 c=(x3-x1)/(y1-y3) d=(-x1-x3)/2+(y1+y3)/2 x=(d-b)/(a-c) y=a*x+b r=math.sqrt((x-x1)**2+(y-y1)**2) print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,r)) except: break
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s348321919
p00010
Wrong Answer
def main(): import math for i in range(int(input())): x1,y1,x2,y2,x3,y3=map(float,input().split()) a=y1-y2 b=y1-y3 if a==0: x=(x1+x2)/2 c=(x3-x1)/(y1-y3) d=(-x1-x3)/2+(y1+y3)/2 y=c*x+d elif b==0: x=(x1+x3)/2 c=(x2-x1)/(y1-y2) d=(-x1-x3)/2+(y1+y3)/2 y=c*x+d else: a=(x2-x1)/(y1-y2) b=(-x1-x2)/2+(y1+y2)/2 c=(x3-x1)/(y1-y3) d=(-x1-x3)/2+(y1+y3)/2 x=(d-b)/(a-c) y=a*x+b r=math.sqrt((x-x1)**2+(y-y1)**2) print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s670226460
p00010
Wrong Answer
def main(): import math for i in range(int(input())): x1,y1,x2,y2,x3,y3=map(float,input().split()) a=y1-y2 b=y1-y3 if a==0: x=(x1+x2)/2 c=(x3-x1)/(y1-y3) d=(-x1-x3)/2+(y1+y3)/2 y=c*x+d elif b==0: x=(x1+x3)/2 c=(x2-x1)/(y1-y2) d=(-x1-x2)/2+(y1+y2)/2 y=c*x+d else: a=(x2-x1)/(y1-y2) b=(-x1-x2)/2+(y1+y2)/2 c=(x3-x1)/(y1-y3) d=(-x1-x3)/2+(y1+y3)/2 x=(d-b)/(a-c) y=a*x+b r=math.sqrt((x-x1)**2+(y-y1)**2) print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s619240772
p00010
Wrong Answer
def main(): import math for i in range(int(input())): x1,y1,x2,y2,x3,y3=map(float,input().split()) a=y1-y2 b=y1-y3 if a==0: x=(x1+x2)/2 c=(x3-x1)/(y1-y3) d=(-x1-x3)/2+(y1+y3)/2 y=c*x+d elif b==0: x=(x1+x3)/2 c=(x2-x1)/(y1-y2) d=(-x1-x2)/2+(y1+y2)/2 y=c*x+d else: a=(x2-x1)/(y1-y2) b=(-x1-x2)/2+(y1+y2)/2 c=(x3-x1)/(y1-y3) d=(-x1-x3)/2+(y1+y3)/2 x=(d-b)/(a-c) y=a*x+b r=math.sqrt((x-x1)**2+(y-y1)**2) print('{:.3f} {:.3f} {:.3f}'.format(x, y, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s176609696
p00010
Wrong Answer
def main(): import math for i in range(int(input())): x1,y1,x2,y2,x3,y3=map(float,input().split()) a=y1-y2 b=y1-y3 if a==0: x=(x1+x2)/2 c=(x3-x1)/(y1-y3) d=c*(-x1-x3)/2+(y1+y3)/2 y=c*x+d elif b==0: x=(x1+x3)/2 c=(x2-x1)/(y1-y2) d=c*(-x1-x2)/2+(y1+y2)/2 y=c*x+d else: a=(x2-x1)/(y1-y2) b=a*(-x1-x2)/2+(y1+y2)/2 c=(x3-x1)/(y1-y3) d=c*(-x1-x3)/2+(y1+y3)/2 x=(d-b)/(a-c) y=a*x+b r=math.sqrt((x-x1)**2+(y-y1)**2) print('{:.3f} {:.3f} {:.3f}'.format(x, y, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s220149053
p00010
Wrong Answer
import math n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) a1 = x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2 a2 = y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2 px = ((y1 - y3) * a1 - (y1 - y2) * a2) / \ (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3)) py = ((x1 - x3) * a1 - (x1 - x2) * a2) / \ (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3)) r = math.sqrt(px ** 2 + py ** 2) print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s426634789
p00010
Wrong Answer
import math n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) a1 = x1 ** 2 - x2 ** 2 + y1 ** 2 - y2 ** 2 a2 = y1 ** 2 - y3 ** 2 + x1 ** 2 - x3 ** 2 px = ((y1 - y3) * a1 - (y1 - y2) * a2) / (2 * (y1 - y3) * (x1 - x2) - 2 * (y1 - y2) * (x1 - x3)) py = ((x1 - x3) * a1 - (x1 - x2) * a2) / (2 * (x1 - x3) * (y1 - y2) - 2 * (x1 - x2) * (y1 - y3)) r = math.sqrt(px ** 2 + py ** 2) print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s501033533
p00010
Wrong Answer
import math n = int(input()) i = 0 while i < n: x1, y1, x2, y2, x3, y3 = map(float,input().split()) a = x2 - x1 b = y2 - y1 c = x3 - x1 d = y3 - y1 e = a * (x1 + x2) + b * (y1 + y3) f = c * (x1 + x2) + d * (y1 + y3) g = 2.0 * (a * (y3 - y2) - b * (x3 - x2)) if g == 0: exit() px = (d * e - b * f) / g py = (a * f - c * e) / g radius = ( (py - y1)*(py - y1) + (px - x1)*(px - x1) ) print("%.3f %.3f %.3f"%(px,py,math.sqrt(radius))) i=i+1
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s682416746
p00010
Wrong Answer
#! -*- coding:utf-8 -*- import math n = input() for x in xrange(n): x1,y1,x2,y2,x3,y3 = map(float,raw_input().split()) a1 = 2.0*(x2-x1) b1 = 2.0*(y2-y1) x12 = x1**2 y12 = y1**2 c1 = x12-x2**2+y12+y2**2 a2 = 2.0*(x3-x1) b2 = 2.0*(y3-y1) c2 = x12-x3**2+y12-y3**2 denom=(a1*b2-a2*b1) x = (b1*c2-b2*c1)/denom y = (c1*a2-c2*a1)/denom r = math.sqrt((x-x1)**2+(y-y1)**2) print "%.3f %.3f %.3f"%(x,y,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s011231205
p00010
Wrong Answer
#! -*- coding:utf-8 -*- import math n = input() for x in xrange(n): x1,y1,x2,y2,x3,y3 = map(float,raw_input().split()) a1 = 2.0*(x2-x1) b1 = 2.0*(y2-y1) x12 = x1**2 y12 = y1**2 c1 = x12-x2**2+y12+y2**2 a2 = 2.0*(x3-x1) b2 = 2.0*(y3-y1) c2 = x12-x3**2+y12-y3**2 denom=(a1*b2-a2*b1) # print "x1^2 : "+str(x12) # print "y1^2 : "+str(y12) # print "a1 : "+str(a1) # print "b1 : "+str(b1) # print "c1 : "+str(c1) # print "a2 : "+str(a2) # print "b2 : "+str(b2) # print "c2 : "+str(c2) # print "denom : "+str(denom) x = (b1*c2-b2*c1)/denom y = (c1*a2-c2*a1)/denom r = math.sqrt((x-x1)**2+(y-y1)**2) print "%.3f %.3f %.3f"%(x,y,r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s744721271
p00010
Wrong Answer
#encoding=utf-8 import math x = input() x1,y1,x2,y2,x3,y3 = map(float, raw_input().split()) p = ((y1 - y3)*(y1**2 - y1**2 + x1**2 - x2**2) - (y1 - y2)*(y1**2 - y3**2 + x1**2 - x3**2))/(2*(y1 - y3)*(x1 - x2) - 2*(y1 - y2)*(x1 - x3)) q = ((x1 - x3)*(x1**2 - x2**2 + y1**2 - y2**2) - (x1 - x2)*(x1**2 - x3**2 + y1**2 - y3**2))/(2*(x1 - x3)*(y1 - y2) - 2*(x1 - x2)*(y1 - y3)) print ("{0:.3f}".format(round(p, 3))),("{0:.3f}".format(round(q, 3))),round(math.sqrt((x1-p)**2 + (y1-q)**2),3)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s272412023
p00010
Wrong Answer
# -*- coding: utf-8 -*- import math class Point_Class(): def __init__(self, x, y): self.x = x self.y = y def calcCenter(p1, p2, p3): p = ((p1.y-p2.y)*(p3.x*p3.x-p1.y*p2.y)+(p2.y-p2.y)*(p1.x*p1.x-p2.y*p3.y)+(p3.y-p1.y)*(p2.x*p2.x-p3.y*p1.y)) / ((-2)*(p1.y*(p2.x-p3.x)+p2.y*(p3.x-p1.x)+p3.y*(p1.x-p2.x))) q = ((p1.x-p2.x)*(p3.y*p3.y-p1.x*p2.x)+(p2.x-p2.x)*(p1.y*p1.y-p2.x*p3.x)+(p3.x-p1.x)*(p2.y*p2.y-p3.x*p1.x)) / ((-2)*(p1.x*(p2.y-p3.y)+p2.x*(p3.y-p1.y)+p3.x*(p1.y-p2.y))) return Point_Class(p, q) def calcRadius(p, pc): return math.sqrt(pow((p.x-pc.x), 2)+pow((p.y-pc.y), 2)) n = int(raw_input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, raw_input().split()) p1 = Point_Class(x1, y1) p2 = Point_Class(x2, y2) p3 = Point_Class(x3, y3) pc = calcCenter(p1, p2, p3) r = calcRadius(p1, pc) print "%f %f %f" %(pc.x, pc.y, r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s243544028
p00010
Wrong Answer
# -*- coding: utf-8 -*- import math class Point_Class(): def __init__(self, x, y): self.x = x self.y = y def calcCenter(p1, p2, p3): p = ((p1.y-p2.y)*(p3.x*p3.x+p1.y*p2.y)+(p2.y-p2.y)*(p1.x*p1.x+p2.y*p3.y)+(p3.y-p1.y)*(p2.x*p2.x+p3.y*p1.y)) / ((-2)*(p1.y*(p2.x-p3.x)+p2.y*(p3.x-p1.x)+p3.y*(p1.x-p2.x))) q = ((p1.x-p2.x)*(p3.y*p3.y-p1.x*p2.x)+(p2.x-p2.x)*(p1.y*p1.y-p2.x*p3.x)+(p3.x-p1.x)*(p2.y*p2.y-p3.x*p1.x)) / ((-2)*(p1.x*(p2.y-p3.y)+p2.x*(p3.y-p1.y)+p3.x*(p1.y-p2.y))) return Point_Class(p, q) def calcRadius(p, pc): return math.sqrt(pow((p.x-pc.x), 2)+pow((p.y-pc.y), 2)) n = int(raw_input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, raw_input().split()) p1 = Point_Class(x1, y1) p2 = Point_Class(x2, y2) p3 = Point_Class(x3, y3) pc = calcCenter(p1, p2, p3) r = calcRadius(p1, pc) print "%f %f %f" %(pc.x, pc.y, r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s605960443
p00010
Wrong Answer
# -*- coding: utf-8 -*- import math class Point_Class(): def __init__(self, x, y): self.x = x self.y = y def calcCenter(p1, p2, p3): p = ((p1.y-p2.y)*(p3.x*p3.x+p1.y*p2.y)+(p2.y-p2.y)*(p1.x*p1.x+p2.y*p3.y)+(p3.y-p1.y)*(p2.x*p2.x+p3.y*p1.y)) / ((-2)*(p1.y*(p2.x-p3.x)+p2.y*(p3.x-p1.x)+p3.y*(p1.x-p2.x))) q = ((p1.x-p2.x)*(p3.y*p3.y+p1.x*p2.x)+(p2.x-p2.x)*(p1.y*p1.y+p2.x*p3.x)+(p3.x-p1.x)*(p2.y*p2.y+p3.x*p1.x)) / (2*(p1.x*(p2.y-p3.y)+p2.x*(p3.y-p1.y)+p3.x*(p1.y-p2.y))) return Point_Class(p, q) def calcRadius(p, pc): return math.sqrt(pow((p.x-pc.x), 2)+pow((p.y-pc.y), 2)) n = int(raw_input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, raw_input().split()) p1 = Point_Class(x1, y1) p2 = Point_Class(x2, y2) p3 = Point_Class(x3, y3) pc = calcCenter(p1, p2, p3) r = calcRadius(p1, pc) print "%f %f %f" %(pc.x, pc.y, r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s189559105
p00010
Wrong Answer
# -*- coding: utf-8 -*- import math class Point_Class(): def __init__(self, x, y): self.x = x self.y = y def calcCenter(p1, p2, p3): p = ((p1.y-p2.y)*(p3.x*p3.x+p1.y*p2.y)+(p2.y-p3.y)*(p1.x*p1.x+p2.y*p3.y)+(p3.y-p1.y)*(p2.x*p2.x+p3.y*p1.y)) / ((-2)*(p1.y*(p2.x-p3.x)+p2.y*(p3.x-p1.x)+p3.y*(p1.x-p2.x))) q = ((p1.x-p2.x)*(p3.y*p3.y-p1.x*p2.x)+(p2.x-p3.x)*(p1.y*p1.y-p2.x*p3.x)+(p3.x-p1.x)*(p2.y*p2.y-p3.x*p1.x)) / ((-2)*(p1.x*(p2.y-p3.y)+p2.x*(p3.y-p1.y)+p3.x*(p1.y-p2.y))) return Point_Class(p, q) def calcRadius(p, pc): return math.sqrt(pow((p.x-pc.x), 2)+pow((p.y-pc.y), 2)) n = int(raw_input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, raw_input().split()) p1 = Point_Class(x1, y1) p2 = Point_Class(x2, y2) p3 = Point_Class(x3, y3) pc = calcCenter(p1, p2, p3) r = calcRadius(p1, pc) print "%f %f %f" %(pc.x, pc.y, r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s920000689
p00010
Wrong Answer
# -*- coding: utf-8 -*- import math class Point_Class(): def __init__(self, x, y): self.x = x self.y = y def calcCenter(p1, p2, p3): p = ((p1.y-p2.y)*(p3.x*p3.x+p1.y*p2.y)+(p2.y-p3.y)*(p1.x*p1.x+p2.y*p3.y)+(p3.y-p1.y)*(p2.x*p2.x+p3.y*p1.y)) / ((-2)*(p1.y*(p2.x-p3.x)+p2.y*(p3.x-p1.x)+p3.y*(p1.x-p2.x))) q = ((p1.x-p2.x)*(p3.y*p3.y+p1.x*p2.x)+(p2.x-p3.x)*(p1.y*p1.y+p2.x*p3.x)+(p3.x-p1.x)*(p2.y*p2.y+p3.x*p1.x)) / ((-2)*(p1.x*(p2.y-p3.y)+p2.x*(p3.y-p1.y)+p3.x*(p1.y-p2.y))) return Point_Class(p, q) def calcRadius(p, pc): return math.sqrt(pow((p.x-pc.x), 2)+pow((p.y-pc.y), 2)) n = int(raw_input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, raw_input().split()) p1 = Point_Class(x1, y1) p2 = Point_Class(x2, y2) p3 = Point_Class(x3, y3) pc = calcCenter(p1, p2, p3) r = calcRadius(p1, pc) print "%f %f %f" %(pc.x, pc.y, r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s460337514
p00010
Wrong Answer
def perpendicular_bisector(p, q): x = (q[0] - p[0]) y = (q[1] - p[1]) return (2 * x, 2 * y, -x**2 - y**2) def gauss_jordan_elimination(Array): # N???M??????Array N = len(Array) if N == 0: return (True, Array) else: M = len(Array[0]) A = [] for i in range(len(Array)): A.append(Array[i][:]) pivot = 0 L = min(N, M) while pivot < L: pivot_v = A[pivot][pivot] pivot_row = pivot for i in range(pivot + 1, L): v = max(A[i][pivot], -A[i][pivot]) if pivot_v < v: pivot_row = i pivot_v = v if pivot_row > pivot: for i in range(M): A[pivot][i], A[pivot_row][i] = A[pivot_row][i], A[pivot][i] if pivot_v == 0: return ('False', A) inv_pivot = 1 / A[pivot][pivot] A[pivot][pivot] = 1 for i in range(pivot + 1, M): A[pivot][i] *= inv_pivot for i in range(N): if i == pivot: continue t = -1 * A[i][pivot] A[i][pivot] = 0 for j in range(pivot + 1, M): A[i][j] += t * A[pivot][j] pivot += 1 return ('True', A) n = int(input()) for _ in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) a = list(perpendicular_bisector((x1, y1), (x2, y2))) b = list(perpendicular_bisector((x1, y1), (x3, y3))) c = [a, b] state, c = gauss_jordan_elimination(c) x = c[0][2] y = c[1][2] r = ((x - x1)**2 + (y - y1)**2)**0.5 print(round(x, 3), round(y, 3), round(r, 3))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s173719510
p00010
Wrong Answer
def perpendicular_bisector(p, q): x = (q[0] - p[0]) y = (q[1] - p[1]) return (2 * x, 2 * y, -x**2 - y**2) def gauss_jordan_elimination(Array): # N???M??????Array N = len(Array) if N == 0: return (True, Array) else: M = len(Array[0]) A = [] for i in range(len(Array)): A.append(Array[i][:]) pivot = 0 L = min(N, M) while pivot < L: pivot_v = A[pivot][pivot] pivot_row = pivot for i in range(pivot + 1, L): v = max(A[i][pivot], -A[i][pivot]) if pivot_v < v: pivot_row = i pivot_v = v if pivot_row > pivot: for i in range(M): A[pivot][i], A[pivot_row][i] = A[pivot_row][i], A[pivot][i] if pivot_v == 0: return ('False', A) inv_pivot = 1 / A[pivot][pivot] A[pivot][pivot] = 1 for i in range(pivot + 1, M): A[pivot][i] *= inv_pivot for i in range(N): if i == pivot: continue t = -1 * A[i][pivot] A[i][pivot] = 0 for j in range(pivot + 1, M): A[i][j] += t * A[pivot][j] pivot += 1 return ('True', A) n = int(input()) for _ in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) a = list(perpendicular_bisector((x1, y1), (x2, y2))) b = list(perpendicular_bisector((x1, y1), (x3, y3))) c = [a, b] state, c = gauss_jordan_elimination(c) x = c[0][2] y = c[1][2] r = ((x - x1)**2 + (y - y1)**2)**0.5 print(-round(x, 3), -round(y, 3), round(r, 3))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s676290318
p00010
Wrong Answer
def perpendicular_bisector(p, q): x = (q[0] - p[0]) y = (q[1] - p[1]) return (2 * x, 2 * y, -x**2 - y**2) def gauss_jordan_elimination(Array): # N???M??????Array N = len(Array) if N == 0: return (True, Array) else: M = len(Array[0]) A = [] for i in range(len(Array)): A.append(Array[i][:]) pivot = 0 L = min(N, M) while pivot < L: pivot_v = A[pivot][pivot] pivot_row = pivot for i in range(pivot + 1, L): v = max(A[i][pivot], -A[i][pivot]) if pivot_v < v: pivot_row = i pivot_v = v if pivot_row > pivot: for i in range(M): A[pivot][i], A[pivot_row][i] = A[pivot_row][i], A[pivot][i] if pivot_v == 0: return ('False', A) inv_pivot = 1 / A[pivot][pivot] A[pivot][pivot] = 1 for i in range(pivot + 1, M): A[pivot][i] *= inv_pivot for i in range(N): if i == pivot: continue t = -1 * A[i][pivot] A[i][pivot] = 0 for j in range(pivot + 1, M): A[i][j] += t * A[pivot][j] pivot += 1 return ('True', A) n = int(input()) for _ in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) a = list(perpendicular_bisector((x1, y1), (x2, y2))) b = list(perpendicular_bisector((x1, y1), (x3, y3))) c = [a, b] state, c = gauss_jordan_elimination(c) x = c[0][2] y = c[1][2] r = ((x - x1)**2 + (y - y1)**2)**0.5 print('{0:.3f} {1:.3f} {2:.3f}'.format(-round(x, 3), -round(y, 3), round(r, 3)))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s340750685
p00010
Wrong Answer
def perpendicular_bisector(p, q): x = (q[0] - p[0]) y = (q[1] - p[1]) return (2 * x, 2 * y, p[0]**2-q[0]**2+p[1]**2-q[1]**2) def gauss_jordan_elimination(Array): # N???M??????Array N = len(Array) if N == 0: return (True, Array) else: M = len(Array[0]) A = [] for i in range(len(Array)): A.append(Array[i][:]) pivot = 0 L = min(N, M) while pivot < L: pivot_v = A[pivot][pivot] pivot_row = pivot for i in range(pivot + 1, L): v = max(A[i][pivot], -A[i][pivot]) if pivot_v < v: pivot_row = i pivot_v = v if pivot_row > pivot: for i in range(M): A[pivot][i], A[pivot_row][i] = A[pivot_row][i], A[pivot][i] if pivot_v == 0: return ('False', A) inv_pivot = 1 / A[pivot][pivot] A[pivot][pivot] = 1 for i in range(pivot + 1, M): A[pivot][i] *= inv_pivot for i in range(N): if i == pivot: continue t = -1 * A[i][pivot] A[i][pivot] = 0 for j in range(pivot + 1, M): A[i][j] += t * A[pivot][j] pivot += 1 return ('True', A) n = int(input()) for _ in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) a = list(perpendicular_bisector((x1, y1), (x2, y2))) b = list(perpendicular_bisector((x1, y1), (x3, y3))) c = [a, b] state, c = gauss_jordan_elimination(c) x = c[0][2] y = c[1][2] r = ((x - x1)**2 + (y - y1)**2)**0.5 print('{0:.3f} {1:.3f} {2:.3f}'.format(-round(x, 3), -round(y, 3), round(r, 3)))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s544397731
p00010
Wrong Answer
from math import sqrt def circle(x1, y1, x2, y2, x3, y3): if x1 == 0: dx = 1 x1 = x1 + dx x2 = x2 + dx x3 = x3 + dx else: dx = 0 if y2 == 0: dy = 1 y1 = y1 + dy y2 = y2 + dy y3 = y3 + dy else: dy = 0 A = [[x1, y1, 1, 1, 0, 0],[x2, y2, 1, 0, 1, 0],[x3, y3, 1, 0, 0, 1]] # print(A) for i in range(3): A[0] = [x/A[0][0] for x in A[0]] A[1] = [A[1][j] - A[1][0] * A[0][j] for j in range(6)] A[2] = [A[2][j] - A[2][0] * A[0][j] for j in range(6)] # print(A) for j in range(3): A[j] = A[j][1:] + A[j][:1] A = A[1:] + A[:1] # print(A) for i in range(3): A[i] = A[i][:3] # print(A) V = [-x1**2-y1**2, -x2**2-y2**2, -x3**2-y3**2] M = [(A[i][0] * V[0] + A[i][1] * V[1] + A[i][2] * V[2]) for i in range(3)] xcenter = -0.5 * M[0] - dx ycenter = -0.5 * M[1] - dy radius = sqrt((M[0]**2) /4 + (M[1]**2) /4 - M[2]) return xcenter, ycenter, radius n = int(input()) for line in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) xc, yc, ra = circle(x1, y1, x2, y2, x3, y3) print(xc, yc,ra)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s083280629
p00010
Wrong Answer
from math import sin,cos,sqrt n=int(input()) out=[] for i in range(n): I=list(map(float,input().split(" "))) #( (x_0,y_0), (x_1,y_1) , (x_2,y_2) ) a_1=I[2]-I[0] #x_1-x_0 a_2=I[4]-I[0] #x_2-x_0 b_1=I[3]-I[1] #y_1-y_0 b_2=I[5]-I[1] #y_2-y_0 #print(a_1,b_1,a_2,b_2) K=(a_2**2 -a_2*b_2+a_1**2-a_1*b_1)/(a_2*b_1-a_1*b_2) O_x=0.5*(b_1-K*b_2) O_y=0.5*(b_2+K*b_1) O_R=sqrt( (I[0]-O_x)**2 + (I[1]-O_y)**2 ) out.append( '{:.3f} {:.3f} {:.3f}'.format(O_x,O_y,O_R) ) for i in out: print(i)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s404874346
p00010
Wrong Answer
from math import sqrt n=int(input()) out=[] for i in range(n): I=list(map(float,input().split(" "))) #( (x_0,y_0), (x_1,y_1) , (x_2,y_2) ) a_1=I[2]-I[0] #x_1-x_0 a_2=I[4]-I[0] #x_2-x_0 b_1=I[3]-I[1] #y_1-y_0 b_2=I[5]-I[1] #y_2-y_0 #print(a_1,b_1,a_2,b_2) K=(a_2**2 -a_2*b_2+a_1**2-a_1*b_1)/(a_2*b_1-a_1*b_2) O_x=0.5*(b_1-K*b_2) O_y=0.5*(b_2+K*b_1) O_R=sqrt( (I[0]-O_x)**2 + (I[1]-O_y)**2 ) out.append( '{:.3f} {:.3f} {:.3f}'.format(O_x,O_y,O_R) ) for i in out: print(i)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s700734347
p00010
Wrong Answer
from math import sin,cos,sqrt n=int(input()) out=[] for i in range(n): I=list(map(float,input().split(" "))) #( (x_0,y_0), (x_1,y_1) , (x_2,y_2) ) a_1=I[2]-I[0] #x_1-x_0 a_2=I[4]-I[0] #x_2-x_0 b_1=I[3]-I[1] #y_1-y_0 b_2=I[5]-I[1] #y_2-y_0 K=(a_2**2 -a_2*b_2+a_1**2-a_1*b_1)/(a_2*b_1-a_1*b_2) O_x=0.5*(b_1-K*b_2) O_y=0.5*(b_2+K*b_1) O_R=sqrt( (I[0]-O_x)**2 + (I[1]-O_y)**2 ) print('{:.3f} {:.3f} {:.3f}'.format(O_x,O_y,O_R)) # out.append( '{:.3f} {:.3f} {:.3f}'.format(O_x,O_y,O_R) ) # for i in out: # print(i)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s359514636
p00010
Wrong Answer
import math def solve(a,b,c,d,e,f): x = - (d*(f**2+e**2-b**2-a**2) + b*(-f**2-e**2) + b**2*f + a**2*f + d**2*(b-f) + c**2*(b-f)) / (c*(2*f-2*b) - 2*a*f + 2*b*e + d*(2*a-2*e)) y = (c*(f**2+e**2-b**2-a**2) + a*(-f**2-e**2) + b**2*e + a**2*e + d**2*(a-e) + c**2*(a-e)) / (c*(2*f-2*b) - 2*a*f + 2*b*e + d*(2*a - 2*e)) r = math.hypot(x-a, y-b) return x,y,r n = int(input()) for _ in range(n): a,b,c,d,e,f = map(float, input().split()) x,y,r = solve(a,b,c,d,e,f) x += 0.0005 y += 0.0005 r += 0.0005 print("{:.3f} {:.3f} {:.3f}".format(x, y, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s465706928
p00010
Wrong Answer
import math x1=0 y1=1 x2=2 y2=3 x3=4 y3=5 n = input() for _ in xrange(n): p = map(float, raw_input().split()) A = p[x1]**2 - p[x2]**2 + p[y1]**2 - p[y2]**2 B = 2*p[x1] - 2*p[x2] C = 2*p[y1] - 2*p[y2] D = p[x1]**2 - p[x3]**2 + p[y1]**2 - p[y3]**2 E = 2*p[x1] - 2*p[x3] F = 2*p[y1] - 2*p[y3] if (C*E-B*F) == 0 or (B*E)==0: print "0.000 0.000 0.000" continue b = (A*E-D*B)/(C*E-B*F) a = (A*E-C*E*b)/(B*E) r = math.sqrt( (p[x1]-a)**2 + (p[y1]-b)**2 ) print "%.3f %.3f %.3f" % (round(a, 3), round(b, 3), round(r, 3))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s551082571
p00010
Wrong Answer
def simultaneous_equasion(a, b, c, d, e, f): "??£???????¨????" det = a * d - b * c a11 = d / det a12 = - b / det a21 = - c / det a22 = a / det return a11 * e + a12 * f, a21 * e + a22 * f n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) # (x1, y1), (x2, y2)????????´???????????? # 2 * (x2 - x1) * x + 2 * (y2 - y1) * y = (y2 - y1) ^ 2 + (x2 - x1) ^ 2 a = 2 * (x2 - x1) b = 2 * (y2 - y1) c = 2 * (x3 - x1) d = 2 * (y3 - y1) e = (y2 - y1) ** 2 + (x2 - x1) ** 2 f = (y3 - y1) ** 2 + (x3 - x1) ** 2 px, py = simultaneous_equasion(a, b, c, d, e, f) print("%.3f %3f" % (round(px, 3), round(py, 3)))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s489954719
p00010
Wrong Answer
import math def simultaneous_equasion(a, b, c, d, e, f): "??£???????¨????" det = a * d - b * c a11 = d / det a12 = - b / det a21 = - c / det a22 = a / det return a11 * e + a12 * f, a21 * e + a22 * f n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3 = map(float, input().split()) # (x1, y1), (x2, y2)????????´???????????? # 2 * (x2 - x1) * x + 2 * (y2 - y1) * y = (y2 - y1) ^ 2 + (x2 - x1) ^ 2 a = 2 * (x2 - x1) b = 2 * (y2 - y1) c = 2 * (x3 - x1) d = 2 * (y3 - y1) e = (y2 - y1) ** 2 + (x2 - x1) ** 2 f = (y3 - y1) ** 2 + (x3 - x1) ** 2 px, py = simultaneous_equasion(a, b, c, d, e, f) r = math.sqrt((px - x1) ** 2 + (py - y1) ** 2) print("%.3f %.3f %.3f" % (round(px, 3), round(py, 3), round(r, 3)))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s960438948
p00010
Wrong Answer
import math def da(li): x1,y1,x2,y2,x3,y3=[float(i) for i in li] xp,yp=(x2-x1)/2,(y2-y1)/2 xq,yq=(x3-x1)/2,(y3-x1)/2 t=(xq**2+yq**2-xp*xq-yp*yq)/(xp*yq-xq*yp) return xp-t*yp,yp+t*xp def sis(fl): fls=str(fl) if len(fls)<6:return fls+"".join(["0" for i in range(5-len(fls))]) if int(fls[5:6])>4: return fls[:4]+str(int(fls[4:5])+1) else: return fls[:5] n=int(input()) for i in range(n): li=input().split(" ") x,y=da(li) print(sis(x)+" "+sis(y)+" "+sis(math.sqrt(x**2+y**2)))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s298861765
p00010
Wrong Answer
import math def da(li): x1,y1,x2,y2,x3,y3=[float(i) for i in li] xp,yp=(x2-x1)/2,(y2-y1)/2 xq,yq=(x3-x1)/2,(y3-x1)/2 t=(xq**2+yq**2-xp*xq-yp*yq)/(xp*yq-xq*yp) return x1+xp-t*yp,y1+yp+t*xp def sis(fl): fls=str(fl) if len(fls)<6:return fls+"".join(["0" for i in range(5-len(fls))]) if int(fls[5:6])>4: return fls[:4]+str(int(fls[4:5])+1) else: return fls[:5] n=int(input()) for i in range(n): li=input().split(" ") x,y=da(li) print(sis(x)+" "+sis(y)+" "+sis(math.sqrt(x**2+y**2)))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s066508365
p00010
Wrong Answer
import math def da(li): x1,y1,x2,y2,x3,y3=[float(i) for i in li] xp,yp=(x2-x1)/2,(y2-y1)/2 xq,yq=(x3-x1)/2,(y3-x1)/2 t=(xq**2+yq**2-xp*xq-yp*yq)/(xp*yq-xq*yp) return x1-(xp-t*yp),y1-(yp+t*xp) def sis(fl): fls=str(fl) if len(fls)<6:return fls+"".join(["0" for i in range(5-len(fls))]) if int(fls[5:6])>4: return fls[:4]+str(int(fls[4:5])+1) else: return fls[:5] n=int(input()) for i in range(n): li=input().split(" ") x,y=da(li) print(sis(x)+" "+sis(y)+" "+sis(math.sqrt(x**2+y**2)))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s827664947
p00010
Wrong Answer
from math import sqrt, fabs def calcu_cirucumcenter(x1, y1, x2, y2, x3, y3): """ ??????O?????§?¨????(x, y)??¨????????¨ (x-x1)**2 + (y-y1)**2 = (x-x2)**2 + (y-y2)**2 x**2 -2*x1*x + x1**2 + y**2 -2*y1*y + y1**2 = ... -2*x2*x, x2**2, -2*y2*y, y2**2 ?????¨????????¨ (-2*x1 + 2*x2)x + (-2y1 + 2*y2)y + (x1**2 + y1**2 - x2**2 - y2**2) = 0 x1, x3???????????????????§???? (-2*x1 + 2*x3)x + (-2y1 + 2*y3)y + (x1**2 + y1**2 - x3**2 - y3**2) = 0 """ a = -2 * x1 + 2 * x2 b = -2 * y1 + 2 * y2 c = -2 * x1 + 2 * x3 d = -2 * y1 + 2 * y3 e = -1* (x1 ** 2 + y1 ** 2 - x2 ** 2 - y2 ** 2) f = -1 * (x1 ** 2 + y1 ** 2 - x3 ** 2 - y3 ** 2) x = 1 / (a * d - b * c) * (d * e - b * f) y = 1 / (a * d - b * c) * (-c * e + a * f) return x, y if __name__ == '__main__': epsilon = 1e-9 # ??????????????\??? num = int(input()) for i in range(num): x1, y1, x2, y2, x3, y3 = [float(x) for x in input().split(' ')] # ?????\????????????(??????)????±??????? x, y = calcu_cirucumcenter(x1, y1, x2, y2, x3, y3) # ?¨????????????¨?????? -0.0 ???????????´???????????¶?????? 0.0 ????????? if fabs(x) < epsilon: x = 0.0 if fabs(y) < epsilon: y = 0.0 # ????????????????????§????????¢????????? r = sqrt((x - x1)**2 + (x - y1)**2) print('{0:.3f} {1:.3f} {2:.3f}'.format(x, y, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s978050678
p00010
Wrong Answer
import sys import math def to_f(e): return float(e) n = int(raw_input().rstrip()) for i in range(n): line = raw_input().rstrip() x1, y1, x2, y2, x3, y3 = map(to_f, line.split(" ")) a1 = 2*(x2-x1) a2 = 2*(x3-x1) b1 = 2*(y2-y1) b2 = 2*(y3-y1) c1 = x1**2-x2**2+y1**2-y2**2 c2 = x1**2-x3**2+y1**2-y3**2 xp = (b1*c2-b2*c1)/(a1*b2-a2*b1) yp = (c1*a2-c2*a1)/(a1*b2-a2*b1) r = math.sqrt((xp-1)**2+(yp-y1)**2) print("{0:.3f} {0:.3f} {0:.3f}".format(xp, yp, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s280675339
p00010
Wrong Answer
from math import sqrt for _ in range(int(input())): x1, y1, x2, y2, x3, y3= map(float, input().split()) a= sqrt((x3-x2)**2 + (y3-y2)**2) b= sqrt((x3-x1)**2 + (y3-y1)**2) c= sqrt((x2-x1)**2 + (y2-y1)**2) numerator, denominator= 2*b*c, b**2 + c**2 - a**2 cosA= denominator / numerator sinA= sqrt(1 - (cosA)**2) r= a / (2*sinA) px= (x2-x1) / 2 py= (y3-y1) / 2 print(px, py, r)
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s471905272
p00010
Wrong Answer
from math import sqrt for _ in range(int(input())): x1, y1, x2, y2, x3, y3= map(float, input().split()) a= sqrt((x3-x2)**2 + (y3-y2)**2) b= sqrt((x3-x1)**2 + (y3-y1)**2) c= sqrt((x2-x1)**2 + (y2-y1)**2) numerator, denominator= 2*b*c, b**2 + c**2 - a**2 cosA= denominator / numerator sinA= sqrt(1 - (cosA)**2) r= a / (2*sinA) px= (x2-x1) / 2 py= (y3-y1) / 2 print("{0:.3f} {1:.3f} {2:.3f}".format(px, py, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s601785171
p00010
Wrong Answer
from math import sqrt n = int(input()) for i in range(n): l = input() x1,y1,x2,y2,x3,y3=map(float,l.split(' ')) a_2 = (x1 - x2)**2 + (y1 - y2)**2 b_2 = (x2 - x3)**2 + (y2 - y3)**2 c_2 = (x3 - x1)**2 + (y3 - y1)**2 cos_a_2 = (b_2 + c_2 - a_2)**2/(4* b_2 * c_2) sin_a_2 = 1 - cos_a_2 r = round(sqrt(a_2/sin_a_2)/2,3) a = (x1**2 - x3**2 + y1**2 - y3**2)*(x2 - x1) b = (x1**2 - x2**2 + y1**2 - y2**2)*(x3 - x1) c = (y2 - y1)*(x3 - x1) d = (y3 - y1)*(x2 - x1) py = round((a-b)/(c-d)/2,3) a = (x1**2 - x3**2 + y1**2 - y3**2)*(y2 - y1) b = (x1**2 - x2**2 + y1**2 - y2**2)*(y3 - y1) c = (x2 - x1)*(y3 - y1) d = (x3 - x1)*(y2 - y1) px = round((a-b)/(c-d)/2,3) print('%s %s %s' %(px, py, r))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>
s068001658
p00010
Wrong Answer
import sys import math n = int(sys.stdin.readline().rstrip()) for i in range(n): x1,y1,x2,y2,x3,y3 = map(float, sys.stdin.readline().rstrip().split(' ')) p = ((y1-y3)*(y1**2-y2**2+x1**2-x2**2)-(y1-y2)*(y1**2-y3**2+x1**2-x3**2)) / (2*(y1-y3)*(x1-x2)-2*(y1-y2)*(x1-x3)) q = ((x1-x3)*(x1**2-x2**2+y1**2-y2**2)-(x1-x2)*(x1**2-x3**2+y1**2-y3**2)) / (2*(x1-x3)*(y1-y2)-2*(x1-x2)*(y1-y3)) r = math.sqrt((p-x1)**2 + (p-y1)**2) print("{:0.3f} {:0.3f} {:0.3f}".format(round(p,3),round(q,3),round(r,3)))
1 0.0 0.0 2.0 0.0 2.0 2.0
1.000 1.000 1.414
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Circumscribed Circle of A Triangle.</H1> <p> Write a program which prints the central coordinate $(p_x, p_y)$ and the radius $r$ of a circumscribed circle of a triangle which is constructed by three points $(x_1, y_1)$, $(x_2, y_2)$ and $(x_3, y_3)$ on the plane surface. </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, the number of datasets $n$ is given. Each dataset consists of:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$<br/> <br/> in a line. All the input are real numbers. </p> <H2>Output</H2> <p> For each dataset, print $p_x$, $p_y$ and $r$ separated by a space in a line. Print the solution to three places of decimals. Round off the solution to three decimal places. </p> <h2>Constraints</h2> <ul> <li>$-100 \leq x_1, y_1, x_2, y_2, x_3, y_3 \leq 100$</li> <li>$ n \leq 20$</li> </ul> <H2>Sample Input</H2> <pre> 1 0.0 0.0 2.0 0.0 2.0 2.0 </pre> <H2>Output for the Sample Input</H2> <pre> 1.000 1.000 1.414 </pre>