又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. waf相关

    google上搜索下面信息: waf site:klionsec.github.io 有几篇比较有意思的问题: https://klionsec.github.io/2017/07/09/nginx- ...

  2. JS 实现 jQuery的$(function(){});

    1.浏览器渲染引擎的HTML解析流程 何谓“渲染”,其实就是浏览器把请求到的HTML内容显示出来的过程.渲染引擎首先通过网络获得所请求文档的内容,通常以8K分块的方式完成.下面是渲染引擎在取得内容之后 ...

  3. Xstream将XML转换为javabean的问题

    1.问题:Xstream is not security 解决方法:加上 2.问题:如果没有第二行代码,会出现xstream forbiddenclassexception 解决方法:加上第二行,其中 ...

  4. 高级设计总监的设计方法论——5W1H需求分析法 KANO模型分析法

    本期开始进入设计方法论的学习,大湿自己也是边学边分享,算是巩固一遍吧: 另外这些理论基本都是交叉结合来应用于工作中,我们学习理论但不要拘泥于理论的框架中,掌握后要灵活运用一点- 这些理论一部分来自于我 ...

  5. SyntaxError: missing ; before statement

    做分页功能,遇到了很坑的事情.前台一直报错:SyntaxError: missing ; before statement 最后发现解决办法是eval("("+s+")& ...

  6. 【转】先说IEnumerable,我们每天用的foreach你真的懂它吗?

    [转]先说IEnumerable,我们每天用的foreach你真的懂它吗? 我们先思考几个问题: 为什么在foreach中不能修改item的值? 要实现foreach需要满足什么条件? 为什么Linq ...

  7. [C#]this.Invoke和this.BeginInvoke的区别

    private void button1_Click(object sender, EventArgs e) { "; this.Invoke(new EventHandler(delega ...

  8. 回文日期(NOIP2016)

    题目:回文日期 这题虽然说不难,但是也不能算水了. 我先讲讲思路.60分的算法很好写,就是判断一下是不是回文串,分离每个数位,判断即可. 但我们的目标是满分,所以我来讲讲满分算法. 首先,给的是区间, ...

  9. hdu 6208(后缀自动机、或者AC自动机

    题意:给你n个字符串,问你是否存在一个字符串可以从中找到其他n-1个字符串. 思路:其实很简单,找到最长的那个字符串对他进行匹配,看是否能匹配到n-1个字符串. 可以用AC自动机或者后缀自动机做,但是 ...

  10. ubuntu安装rubyOnRails

    https://gorails.com/setup/ubuntu/16.04#ruby-rbenv 文章很详细