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),…
题目链接 题意:给出一个数S,求一个最大的数,使这个数所有的因子之和为S; 这个所谓“因子之和”不知道有没有误导性,因为一开始以为得是素数才行.后来复习了下小学数学,比如12的因子分别是1,2,3,4,6,12... 我竟无言以对T^T... 感觉复杂度应该能继续优化的..没想到好的.. 代码: #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include&l…
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…
题意:给定一个 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…
  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 10627 - Infinite Race option=com_onlinejudge&Itemid=8&page=show_problem&category=516&problem=1568&mosmsg=Submission+received+with+ID+13837674" target="_blank" style="">题目链接 题意:一段跑道,A,B分别在两端,速度为u.v,两个人跑到还…
option=com_onlinejudge&Itemid=8&category=516&page=show_problem&problem=1496" style="">题目链接:uva 10555 - Dead Fraction 题目大意:给出一个小数,从...開始能够是不论什么数字,可是保证是无限循环小数.将该小数用分式的形式表示,而且要求分母尽量大. 解题思路:这题主要是怎么将无限循环小数转换成分式,这种: 有小数0.abcdEE…