题目链接:uva 11728 - Alternate
Task
题目大意:给出S,求N,要求N所有的因子和为S。
解题思路:枚举因子i,所有整除i的数和加上i。
#include
#include
const int N = 1005;
int n, c[N], v[N];
void init () {
memset(c, 0, sizeof(c));
...
分类:
其他好文 时间:
2014-07-02 16:55:04
阅读次数:
167
事故:wordpress任何页面全部是404 not found,找不到任何页面。
解决:在nginx.conf中80端口下面的注释消除掉。
location ~ \.php$ {
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index...
分类:
其他好文 时间:
2014-07-02 16:48:32
阅读次数:
221
程序猿在开发过程中,使用文件的几率是相当大的,有时候,我们甚至需要几十秒内读取一下IO流中的数据,但是原生态的文件流的读写,一旦操作不当,就有可能出现内存溢出和打开文件数过多的异常错误,这一点在Linux环境下表现得尤其突出,所以使用好原生态的读写文件流真的很重要!好啦,这里着重来讲一下Google的Guava对IO的操作升级,上一篇讲的Guava对Collection的优化,魅力之处尽在不言中了...
分类:
其他好文 时间:
2014-07-02 16:45:56
阅读次数:
276
题意:n个数,m次询问,每次问区间a到b之间的和为s,问有几次冲突
思路:带权并查集的应用,[a, b]和为s,所以a-1与b就可以确定一条边,通过计算与根的距离可以判断出询问的正确性
#include
#include
#include
#include
using namespace std;
const int MAXN = 200010;
int f[MAXN],arr[MA...
分类:
其他好文 时间:
2014-07-02 16:38:40
阅读次数:
177
本题是一般最近对点求解,稍微增加点限定:有两个集合点,要求不同集合中的点的最近对。
那么就增加一个判断,如果是同一个集合中的点,那么就返回最大值,其他和一般的最近对点解法一样。
注意:本题数据有重合点,那么就要防止分类的时候溢出。
Geeks上的最近对的程序是无法处理有重合点的情况的。
#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-07-02 15:27:59
阅读次数:
402
题目连接:uva 294 - Divisors
题目大意:给出一个范围L~U,问说在该范围中因子数最多的数是多少。
解题思路:枚举L~U中的数,将数分解成质因子,利用乘法原理求总因子数。
#include
#include
#include
int countFactor (int x) {
int ans = 1;
int m = sqrt(x+0.5);
...
分类:
其他好文 时间:
2014-07-02 15:27:15
阅读次数:
298
题目链接:uva 10127 - Ones
题目大意:给出n,问说者少要多少为1才可以整除n。
解题思路:等于是高精度取模,直到余数为0为止。
#include
#include
int main () {
int n;
while (scanf("%d", &n) == 1) {
int ans = 1, c = 1;
whil...
分类:
其他好文 时间:
2014-07-02 15:16:16
阅读次数:
210
取Sevice和directive的引用3: Grab any ServicesWe can grab a reference to any service using theinjectorfunction of element wherengAppwas defined (or grab the...
分类:
Web程序 时间:
2014-07-02 14:57:17
阅读次数:
253
sprintf函数太大,在STM8上面根本不敢用,动不动就.text overflow。为了将采集的数值通过串口上传到计算机,只能自己写了一个浮点数转换成字符串的函数: #include #include static char table[]={'0', '1', '2', '3', '4', '...
分类:
其他好文 时间:
2014-07-02 14:54:49
阅读次数:
206