uva 11728 Alternate Task】的更多相关文章

版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/u011328934/article/details/36409469 option=com_onlinejudge&Itemid=8&page=show_problem&category=474&problem=2828&mosmsg=Submission+received+with+ID+13820744" rel="nofollow"…
Uva 11728 - Alternate Task 题目链接 题意:给定一个因子和.求出相应是哪个数字 思路:数字不可能大于因子和,对于每一个数字去算出因子和,然后记录下来就可以 代码: #include <stdio.h> #include <string.h> const int N = 1005; int n, ans[N]; void init() { memset(ans, -1, sizeof(ans)); for (int i = 1; i <= 1000;…
vjudge 上题目链接:uva 11728 其实是个数论水题,直接打表就行: #include<cstdio> #include<algorithm> using namespace std; ]; inline ) { ; i <= n; ++i) { ; ; j <= i; ++j) ) sum += j; ) ans[sum] = i; } } int main() { ; init(); while(~scanf("%d",&s),…
Little Hasan loves to play number games with his friends. One day they were playing a game whereone of them will speak out a positive number and the others have to tell the sum of its factors. Thefirst one to say it correctly wins. After a while they…
题目链接 题意:给出一个数S,求一个最大的数,使这个数所有的因子之和为S; 这个所谓“因子之和”不知道有没有误导性,因为一开始以为得是素数才行.后来复习了下小学数学,比如12的因子分别是1,2,3,4,6,12... 我竟无言以对T^T... 感觉复杂度应该能继续优化的..没想到好的.. 代码: #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include&l…
题意:给定一个 n,求一个最大正整数 N 使得 N 的所有正因数和等于 n. 析:对于任何数一个 n,它的所有正因子都是大于等于本身的,因为 n 本身就是自己的正因数,这样的就可以直接暴力了,答案肯定是在 1 ~ n 范围内. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib&…
题意: 输入一个正整数S,(S  <= 1000)求一个最大的正整数N,使得N的所有正因子之和为S. 解析: ..求1000以内的所有数的正因子和 ...输出.. #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #inc…
Frm: IEEE Std 1364™-2001, IEEE Standard Verilog® Hardware Description Language 10. Tasks and functions Tasks and functions provide the ability to execute common procedures from several different places in a description. They also provide a means of b…
题目传送门 /* 题意:bob按照指定顺序行走,他的狗可以在他到达下一个点之前到一个景点并及时返回,问狗最多能走多少个景点 匈牙利算法:按照狗能否顺利到一个景点分为两个集合,套个模板 */ #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> using namespace std; ; const int INF…
A Different Task The (Three peg) Tower of Hanoi problem is a popular one in computer science. Briefly the problem is to transfer all the disks from peg-A to peg-C using peg-B as intermediate one in such a way that at no stage a larger disk is above a…