UVA138 Street Numbers(数论)】的更多相关文章

题目链接. 题意: 找一个n,和一个m(m < n),求使得1~m的和等于m~n的和,找出10组m,n 分析: 列出来式子就是 m*(m+1)/2 = (n-m+1)*(m+n)/2 化简后为 m*m*2 = n*(n+1) 可以枚举n,然后二分找m,不过这样大约会用10s多,可以打表. 打表程序: #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #…
任意门:http://poj.org/problem?id=1320 Street Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3181   Accepted: 1776 Description A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the…
传送门 Street Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2529   Accepted: 1406 Description A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks…
Street Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 3078   Accepted: 1725 Description A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks her…
Street Numbers Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 2753   Accepted: 1530 Description A computer programmer lives in a street with houses numbered consecutively (from 1) down one side of the street. Every evening she walks her…
  Carmichael Numbers  An important topic nowadays in computer science is cryptography. Some people even think that cryptography is the only important field in computer science, and that life would not matter at all without cryptography. Alvaro is one…
UVA 10539 - Almost Prime Numbers 题目链接 题意:给定一个区间,求这个区间中的Almost prime number,Almost prime number的定义为:仅仅能整除一个素数. 思路:既然是仅仅能整除一个素数,那么这些数肯定为素数的x次方(x > 1),那么仅仅要先打出素数表,然后在素数表上暴力找一遍就能够了,由于素数表仅仅要找到sqrt(Max),大概100W,然后每一个数找的复杂度为log(n),这样复杂度是能够接受的. 代码: #include <…
DZY Loves Fibonacci Numbers Time Limit:4000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Appoint description:  System Crawler  (2014-07-14) Description In mathematical terms, the sequence Fn of Fibonacci numbers is defi…
题目链接:POJ 3641 Description Fermat's theorem states that for any prime number p and for any integer a > 1, ap = a (mod p). That is, if we raise a to the pth power and divide by p, the remainder is a. Some (but not very many) non-prime values of p, know…
主题链接: http://poj.org/problem?id=1320 题目大意: 求解两个不相等的正整数N.M(N<M),使得 1 + 2 + - + N = (N+1) + - + M.输出前10组满足要求 的(N,M). 思路: 要使 1 + 2 + - + N = (N+1) + - + M,那么 N*(N+1)/2 = (M-N)(M+N+1)/2,即 (2*M+1)^2 - 8*N^2 - 1.令x = 2*M + 1.y = N,就有x^2 - 8*y^2 = 1.就变成了典型的…