OpenJudge/Poj 1844 Sum】的更多相关文章

1.链接地址: http://bailian.openjudge.cn/practice/1844 http://poj.org/problem?id=1844 2.题目: Sum Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10031   Accepted: 6564 Description Consider the natural numbers from 1 to N. By associating to eac…
链接: http://poj.org/problem?id=1844 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=29256#problem/D Sum Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 9795   Accepted: 6406 Description Consider the natural numbers from 1 to N. By a…
题意:给一个整数n,求当n由1到k的连续整数加或减组成时的最小的k. 解法:一开始觉得dp……后来觉得复杂度太大了……GG……百度了一下是个数学题orz. 如果n全部由加法组成,那么k可以组成k(k+1)/2,设减掉的部分为s,则有k(k+1)/2-2s=n,所以n和k(k+1)/2mod2同余. 代码: #include<stdio.h> #include<iostream> #include<algorithm> #include<string> #in…
POJ 2739 Sum of Consecutive Prime Numbers Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu   Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representati…
POJ.2739 Sum of Consecutive Prime Numbers(水) 代码总览 #include <cstdio> #include <cstring> #include <vector> #include <cmath> #define nmax 10005 using namespace std; int prime[nmax],n; vector<int> vprime; void init() { memset(pri…
POJ 2739 Sum of Consecutive Prime Numbers(素数) http://poj.org/problem? id=2739 题意: 给你一个10000以内的自然数X.然后问你这个数x有多少种方式能由连续的素数相加得来? 分析: 首先用素数筛选法把10000以内的素数都找出来按从小到大保存到prime数组中. 然后找到数X在prime中的上界, 假设存在连续的素数之和==X, 那么一定是从一个比X小的素数開始求和(不会超过X的上界),直到和sum的值>=X为止. 所…
Sum Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 10494   Accepted: 6895 Description Consider the natural numbers from 1 to N. By associating to each number a sign (+ or -) and calculating the value of this expression we obtain a sum S…
1.链接地址: http://bailian.openjudge.cn/practice/2000 http://poj.org/problem?id=2000 2.题目: 总Time Limit: 1000ms Memory Limit: 65536kB Description The king pays his loyal knight in gold coins. On the first day of his service, the knight receives one gold c…
1.链接地址: http://bailian.openjudge.cn/practice/1915 http://poj.org/problem?id=1915 2.题目: 总Time Limit: 1000ms Memory Limit: 65536kB Description BackgroundMr Somurolov, fabulous chess-gamer indeed, asserts that no one else but him can move knights from o…
1.链接地址: http://bailian.openjudge.cn/practice/1163 http://poj.org/problem?id=1163 2.题目: 总时间限制: 1000ms 内存限制: 65536kB 描述 73 88 1 02 7 4 44 5 2 6 5 (Figure 1) Figure 1 shows a number triangle. Write a program that calculates the highest sum of numbers pa…