又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. android--Activity有返回值的跳转

    AndroidManifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xm ...

  2. RNA-seq流程需要进化啦!

    RNA-seq流程需要进化啦! Posted on 2015年9月25日 Tophat 首次被发表已经是6年前 Cufflinks也是五年前的事情了 Star的比对速度是tophat的50倍,hisa ...

  3. windows下git的使用方法(码云)

    这表文章主要是用了可视化操作: 使用命令行操作:https://www.cnblogs.com/mswyf/p/9370238.html 一.安装Git Bash 为了在windows下使用Git,我 ...

  4. mysql 5.17 的update失败问题

    在使用workbench的时候,写入update语句,会很提现失败,原因是安全模式; 可能是workbench在数据库更新的时候是有限制的,防止错误哦l 更改方法也很简单; Edit - Profer ...

  5. 通过代理上网时,qq等应用程序连网出错

    虽然现在基本上都用无线,有线宽带等,但是有时候还是避免不了通过代理上网时,于是就发生浏览器可以正常浏览网页,qq等应用程序连接出错等问题,上网搜了好长时间,    都没解决问题,后来慢慢琢磨(其实是乱 ...

  6. 基于内存,redis,mysql的高速游戏数据服务器设计架构 ZT

    zt  http://www.cnblogs.com/captainl1993/p/4788236.html 1.数据服务器详细设计 数据服务器在设计上采用三个层次的数据同步,实现玩家数据的高速获取和 ...

  7. centos6.5 yum安装postgresql9.3

    rpm -ivh http://download.postgresql.org/pub/repos/yum/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-2.n ...

  8. 20155312 2016-2017-2 《Java程序设计》第十周学习总结

    20155312 2016-2017-2 <Java程序设计>第十周学习总结 ## 课堂内容总结 数组 遍历数组: for(...,arr) for(i=0;i<arr.length ...

  9. SHELL脚本取系统当前年月日问题 (去0)

    1. #!/bin/bash tmonth=`date +%m`tyear=`date +%y`tday=`date +%d`day=`expr $tday + 0`month=`expr $tmon ...

  10. set集合的排序

    在hibernate的OneToMany的实体关联的时候,one端的set是无序的,可是需要按照顺序来搞的话就比较麻烦了. 下面给出一个例子. Set<DiaryPicture> diar ...