ural 2032 Conspiracy Theory and Rebranding 链接:http://acm.timus.ru/problem.aspx?space=1&num=2032 题意:给定一个三角形的三条边 (a, b, c),问是否可放在二维坐标,使得3个顶点都是整数点.若可以,输出任意一组解,否则,输出 -1. 思路:暴力枚举:以 a 为半径做第一象限的 1/4 圆, 以 b 为半径做 一.四 象限的半圆,存储整数点的解,暴力枚举 a 整数点与 b 整数点是否构成长度为 c…
题意: 给定一个整数L(L<=1e12),计算(x,y,z)组的个数.其中x<y<z,x^2+y^2=z^2,gcd(x,y)==1,gcd(x,z)==1,gcd(y,z)==1. 思路: 以下的方法可用来找出勾股数.设m>n . m 和 n 均是正整数, a = m^2-n^2 b = 2mn c = m^2+n^2 若 m 和 n 是互质,而且 m 和 n 其中有一个是偶数,计算出来的 (a, b, c) 就是素勾股数 然后我们需要的便是计算m,n互质 qie m,…
题目来源:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3&page=show_problem&problem=42 Fermat vs. Pythagoras Background Computer generated and assisted proofs and verification occupy a small niche in the realm…
暂时搞不到<Programming Erlang>,最近就一直在看Erlang自带的例子和Reference Manual.基础语法方面有一些过去遗漏或者没有注意的,断断续续仅记于此. 1.Erlang的保留字有: after and andalso band begin bnot bor bsl bsr bxor case catch cond div end fun if let not of or orelse query receive rem try when xor 基本都是些用于…
title: A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc. 翻译: 勾股数组就是三个自然数a, b…
题目链接: C. Pythagorean Triples time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appea…
我是俩循环暴力 看了看给的文档,英语并不好,有点懵,所以找了个中文的博客看了看:勾股数组学习小记.里面有两个学习链接和例题. import math def calc(): for i in range(1,1000): j = i+1 while j <= 1000: c = i*i+j*j c = int(math.sqrt(c)) if i+j+c > 1000: break if i < j < c and i+j+c == 1000 and i*i+j*j == c*c:…
Series的简单运算 import numpy as np import pandas as pd s1=pd.Series([1,2,3],index=['A','B','C']) print(s1) 结果: A 1 B 2 C 3 dtype: int64 s2=pd.Series([4,5,6,7],index=['B','C','D','E']) print(s2) 结果: B 4 C 5 D 6 E 7 dtype: int64 print(s1+s2)#对应的index相加,NaN…
Season 1, Episode 9: Tweener - Seth: You have got to help me. 你一定要帮我 -Burrows:You've got to help me. 你一定要帮我 -Pope: You're talking to the wrong man. This is a matter for the police. matter: 有关系 police: 警察 你找错人了,这是警察的事 -Burrows: This is my son we're ta…