又Orz了一发rng_58。。

250pt:

题意:给定一种兔子数:当S(x*x) = S(x)*S(x)时,x为兔子数,其中S(x)表示各个数位之和。

思路:本来想了一个复杂度很高的想法。。然后想看一下是否正确时,才知道是是找规律。。原来规律就是x的每一位只可能是0-3.所以直接枚举即可。。

code:

 #line 7 "RabbitNumber.cpp"
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std; #define PB push_back
#define MP make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<double> VD;
typedef long long LL;
typedef pair<int,int> PII; class RabbitNumber
{
public:
int L, R;
set<int> S1;
int S(long long x){
int res = ;
for (;x;) res += x % , x /= ;
return res;
}
void dfs(int number, int k){
if (k == ){
if (number < L || number > R) return;
if (number && S(number) * S(number) == S((long long)(number) * number)) S1.insert(number);
return;
}
for (int i = ; i <= ; ++i) dfs(number * + i, k + );
}
int theCount(int low, int high)
{
L = low;
R = high;
S1.clear();
if (high == ) S1.insert(R);
dfs(, );
return (int)S1.size();
} };

500pt

题意:一个堆栈,每次往里面扔一个气球(气球有四种颜色,可任意选一个放进去),每次当栈顶有L<=10个气球的时候,这L个将会破掉。问往里面扔N<=1000后并且最后栈为空的方案数

思路:想了好久还是不会做。。不过思路确实不难。

dp[i][j]表示放了i个气球,并且还需要j个气球可使栈为空的方案数。

那么,如果当前j为0,不管放什么颜色都还需要L-1个球来消掉。

如果j不为0,有两种情况,一种放跟栈顶颜色一样,则j-1,否者j+L-1

code:

 // BEGIN CUT HERE
/* */
// END CUT HERE
#line 7 "PuyoPuyo.cpp"
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
using namespace std; #define PB push_back
#define MP make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define fep(i,n) for(int i=0;i<=(n);++i)
#define M 1000000007
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<double> VD;
typedef long long LL;
typedef pair<int,int> PII;
int dp[][]; class PuyoPuyo
{
public:
int theCount(int L, int N)
{
memset(dp, , sizeof(dp));
dp[][] = ;
rep(i, N) fep(j, N) if (dp[i][j]){
if (j) dp[i+][j-] = (dp[i+][j-] + dp[i][j]) % M;
else dp[i+][L-] = (dp[i+][L-] + ((long long)dp[i][j] * ) % M) % M;
if (j && j + L - <= N)
dp[i+][j + L - ] = (dp[i+][j + L - ] + ((long long)dp[i][j] * ) % M) % M;
}
return dp[N][];
}
};

SRM484的更多相关文章

随机推荐

  1. andorid 手机外部储存

    .xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android ...

  2. [中英对照]Introduction to DPDK: Architecture and Principles | DPDK概论: 体系结构与实现原理

    [中英对照]Introduction to DPDK: Architecture and Principles | DPDK概论: 体系结构与实现原理   Introduction to DPDK: ...

  3. CODE[VS]2494 Vani和Cl2捉迷藏

    原题链接 这里有一个结论:最多能选取的藏身点个数等于最小路径可重复点覆盖的路径总数. 所以我们可以先传递闭包,然后求最小路径点覆盖即可. #include<cstdio> #include ...

  4. MCS-51与8086指令系统比较

  5. 【jdbcTemplate】baseDao书写规范

    今天加班,为了下个月的北京之行,希望父亲身体安康,一切顺利: 老大今天发出来同事的代码,并标记了jdbcTemplate的书写规范,此处查询数据库之前声明对象时,不用new出来,因为在底层源码中已经给 ...

  6. Partition Array Into Three Parts With Equal Sum LT1013

    Given an array A of integers, return true if and only if we can partition the array into three non-e ...

  7. file-downloader相关问题

    2017-05-24 file-downloader框架中,如果你想用FileDownloader中的createAndStart(String url, String saveDir, String ...

  8. MVVM模式理解

    MVVM 是Model-View-ViewModel 的缩写,它是一种基于前端开发的架构模式,其核心是提供对View 和 ViewModel 的双向数据绑定,这使得ViewModel 的状态改变可以自 ...

  9. mysql 压缩版安装

    环境介绍:win2008_x64+mysql5.7.10  64位 1.将压缩包解压到d:\\mysql目录,并将mysql目录中的my-default.ini 重命名为my.ini 2.将my.in ...

  10. (转贴)fusionCharts属性参考API

    一.FusionCharts的分类 关于FusionCharts的基本介绍我就不在这里浪费篇幅了,想了解的朋友自己去www.baigoogedu.com里面找吧.我就说说FusionCharts的官方 ...