又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. 使用Trinity拼接以及分析差异表达一个小例子

    使用Trinity拼接以及分析差异表达一个小例子  2017-06-12 09:42:47     293     0     0 Trinity 将测序数据分为许多独立的de Brujin grap ...

  2. UISwitch开关控件属性介绍以及获取开关状态并做出响应

    (1)UISwitch的大小也是固定的,不随我们frame设置的大小改变:也是裁剪成圆角的,设置背景就露马脚发现背景是矩形. (2)UISwitch的背景图片设置无效,即我们只能设置颜色,不能用图片当 ...

  3. 在开发node.js中,关于使用VS2013插件出现一直读取资源的问题

    情况描述: 1.安装了VS2013: 2.安装了VS开发node.js的插件; 3.打开以前的工程文件,有的可以打开,有的打不开.而且打不开的始终停留在读取资源的界面.很痛苦的.等半天都没有反应.到底 ...

  4. sys安装

    1.将SYS驱动文件放到系统目录的SYSTEM32目录中.2.按WIN+R组合键,在运行框中输入:regsvr32 sys所在全路径,点击确定即可.

  5. 利用PHP脚本辅助MySQL数据库管理1-表结构

    <?php $dbi = new DbMysql; $dbi->dbh = 'mysql://root:mysql@127.0.0.1/coffeetest'; $map = array( ...

  6. Elastix GOIP 网关配合

    方案一 Gateway disallow=allallow=alaw&ulawcanreinvite=nodtmfmode=rfc2833host=192.168.1.108insecure= ...

  7. Linux学习笔记:Jenkins的使用

    在windows中使用Jenkins(Linux系统下类似),步骤是: 1 从官网下载jenkins项目的war包 2 将jenkins.war放到tomcat的webapps目录中,启动tomcat ...

  8. 得到一个Object的属性

    private static object GetPropertyValue(object obj, string property) { System.Reflection.PropertyInfo ...

  9. svn 修改原来包名的方法和会报的错误

    SVN E200009 which is not part of the commit; both sides of the move must be committed together 在svn上 ...

  10. 【RabbitMQ】 RabbitMQ安装

    MQ全称为Message Queue, 消息队列(MQ)是一种应用程序对应用程序的通信方法.应用程序通过读写出入队列的消息(针对应用程序的数据)来通信,而无需专用连接来链接它们.消息传递指的是程序之间 ...