UVA 10623 - Thinking Backward
题目链接
题意:给定一个数量,求用圆,椭圆,三角形分割平面,分割出该数量,输出所有情况
思路:有公式2 + 2m(m-1) + n(n-1) + 4mn + 3p(p-1) + 6mp + 6np
由于m和p都是[0,100],所以可以枚举m和p,去求出n,然后判断合不合适
代码:
#include
...
分类:
其他好文 时间:
2014-07-02 17:02:41
阅读次数:
179
题目链接: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
题目如下:
Dungeon Master
You are trapped in a 3D dungeon and need to find the quickest way out!The dungeon is composedof unit cubes which may or may not be filled with rock. It ...
分类:
其他好文 时间:
2014-07-02 16:53:39
阅读次数:
199
题目链接:uva 10090 - Marbles
题目大意:给出n,表示有n个珠子,现在要用若干个盒子来装。有两种盒子,一种价钱c1,可以装t1个珠子,另一种价钱c2,可以装t2个珠子。要求所卖的盒子刚好装n个珠子,并且价钱最小的方案。
解题思路:用拓展欧几里得算法求出xt1+yt2=n的一对解x′和y′,这样就有通解:
x=x′ngcd(t1,t2)+t2gcd(t1,t2)k
...
分类:
其他好文 时间:
2014-07-02 16:26:26
阅读次数:
197
题目链接:uva 10515 - Powers Et Al.
题目大意:给出m和n,问说mn的个数上的数是多少。
解题思路:其实只要看m的最后一位数就可以了,判断最有一位的周期,然后用n%t即可。
#include
#include
#include
using namespace std;
const int maxn = 15;
const int maxs = 105...
分类:
其他好文 时间:
2014-07-02 16:25:50
阅读次数:
208
题目连接: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
题目链接:点击打开链接
溢出了半天,觉累不爱
#include
#include
using namespace std;
#define ll int
int main(){
ll Cas= 1, T; cin>>T;
while(T--){
ll n;
cin>>n;
double sum = 0, a;
double hehe = 0;
for(ll i =...
分类:
其他好文 时间:
2014-07-02 09:43:47
阅读次数:
201
UVA 1436 - Counting heaps
题目链接
题意:给定一个树的结构,放1-n数字进去,父亲结点值必须小于子节点,问情况有几种.
思路:f[u]表示以u为子树的情况,那么子树情况为f(v1), f(v2), f(v3)... f(vn).去组成子树相当于从中选s(v1), s(v2), s(v3) ... s(vn).根据组合数学,情况为f(v1)
f(v2) ...
分类:
其他好文 时间:
2014-07-02 09:42:35
阅读次数:
187
UVa 12712 Pattern Locker(简单排列组合数学题)...
分类:
其他好文 时间:
2014-07-02 08:51:28
阅读次数:
185