T1:给len=1e5的数字串,操作为将某个位置起始的后缀搬到最前面。求有多少个不重复的比原串大和多少个小。

=>maya这铁定可以找出些什么规律来。然后就over 了。

=>字符串hash一下就可以了。

//map的常数还是很大的。hash的时候o->to一定要ll!!! 23333 999983

#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,s,t) for(int i=s;i<=t;i++)
#define dwn(i,s,t) for(int i=s;i>=t;i--)
#define clr(x,c) memset(x,c,sizeof(x))
#define ll unsigned long long
#define qwq(x) for(edge *o=head[x];o;o=o->next)
int read(){
int x=0;char c=getchar();
while(!isdigit(c)) c=getchar();
while(isdigit(c)) x=x*10+c-'0',c=getchar();
return x;
}
const int nmax=2e5+5;
const int inf=0x7f7f7f7f;
const int mod=999983;
char s[nmax];ll p[nmax],eo[nmax];
ll cal(int l,int r){
return p[r]-p[l-1]*eo[r-l+1];
}
int find(int tl,int tr){
int ans=0,mid,l=1,r=tr-tl+1;
while(l<=r){
mid=l+r>>1;
if(cal(1,mid)==cal(tl,tl+mid-1)) ans=mid,l=mid+1;
else r=mid-1;
}
return ans;
}
struct edge{
ll to;edge *next;
};edge es[mod<<1],*pt=es,*head[mod<<1];
bool check(ll x){
int t=x%mod;
qwq(t) if(o->to==x) return 1;return 0;
}
void add(ll x){
int t=x%mod;
pt->to=x;pt->next=head[t];head[t]=pt++;
}
int main(){
freopen("number.in","r",stdin);freopen("number.out","w",stdout);
scanf("%s",s+1);int n=strlen(s+1);
rep(i,1,n) s[i+n]=s[i];
eo[0]=1;rep(i,1,n+n) eo[i]=eo[i-1]*233ll;
p[0]=1;rep(i,1,n+n) p[i]=p[i-1]*233ll+s[i]-'0';
int ans=0,res=0,cur;ll ts;
rep(i,2,n){
ts=cal(i,i+n-1);cur=find(i,i+n-1);
if(cur==n||check(ts)) continue;
if(s[i+cur]>s[cur+1]) res++,add(ts);else ans++,add(ts);
}
printf("%d 1 %d\n",ans,res);
fclose(stdin);fclose(stdout);
return 0;
}

T2:每次可以捞出一条任意品种的鱼或者捞不出什么鱼。n个品种。给出每一次捞出某个品种的鱼的概率。求捞出全部品种的鱼的期望次数。

=>http://blog.csdn.net/u011787119/article/details/40151201 里的题差不多。。。然而我最后/tm我一开始总是写成(1-tm)。。。

#include<cstdio>
#include<cstring>
#include<cctype>
#include<algorithm>
using namespace std;
#define rep(i,s,t) for(int i=s;i<=t;i++)
#define dwn(i,s,t) for(int i=s;i>=t;i--)
#define clr(x,c) memset(x,c,sizeof(x))
int read(){
int x=0,f=1;char c=getchar();
while(!isdigit(c)){
if(c=='-') f=-1;c=getchar();
}
while(isdigit(c)) x=x*10+c-'0',c=getchar();
return x*f;
}
const int nmax=3050000;
const int inf=0x7f7f7f7f;
double p[nmax],dp[nmax];int t[26];
int main(){
freopen("fish.in","r",stdin);freopen("fish.out","w",stdout);
int n=read();p[n+1]=1.0;
rep(i,1,n) scanf("%lf",&p[i]),p[n+1]-=p[i];
int st=(1<<n)-1;dp[st]=0.0;double tm=0;
dwn(i,st-1,0){
rep(j,1,n) t[j]=0;t[0]=0;tm=0;
for(int tp=i;tp;tp>>=1) t[++t[0]]=tp&1;
rep(j,1,n) if(t[j]==0) dp[i]+=dp[i+(1<<(j-1))]*p[j],tm+=p[j];
dp[i]+=1.0;dp[i]/=tm;
}
printf("%.2lf\n",dp[0]);
fclose(stdin);fclose(stdout);
return 0;
}

T3:????不懂。。。

noip模拟赛#42的更多相关文章

  1. NOIP模拟赛20161022

    NOIP模拟赛2016-10-22 题目名 东风谷早苗 西行寺幽幽子 琪露诺 上白泽慧音 源文件 robot.cpp/c/pas spring.cpp/c/pas iceroad.cpp/c/pas ...

  2. contesthunter暑假NOIP模拟赛第一场题解

    contesthunter暑假NOIP模拟赛#1题解: 第一题:杯具大派送 水题.枚举A,B的公约数即可. #include <algorithm> #include <cmath& ...

  3. NOIP模拟赛 by hzwer

    2015年10月04日NOIP模拟赛 by hzwer    (这是小奇=> 小奇挖矿2(mining) [题目背景] 小奇飞船的钻头开启了无限耐久+精准采集模式!这次它要将原矿运到泛光之源的矿 ...

  4. 大家AK杯 灰天飞雁NOIP模拟赛题解/数据/标程

    数据 http://files.cnblogs.com/htfy/data.zip 简要题解 桌球碰撞 纯模拟,注意一开始就在袋口和v=0的情况.v和坐标可以是小数.为保险起见最好用extended/ ...

  5. 队爷的讲学计划 CH Round #59 - OrzCC杯NOIP模拟赛day1

    题目:http://ch.ezoj.tk/contest/CH%20Round%20%2359%20-%20OrzCC杯NOIP模拟赛day1/队爷的讲学计划 题解:刚开始理解题意理解了好半天,然后发 ...

  6. 队爷的Au Plan CH Round #59 - OrzCC杯NOIP模拟赛day1

    题目:http://ch.ezoj.tk/contest/CH%20Round%20%2359%20-%20OrzCC杯NOIP模拟赛day1/队爷的Au%20Plan 题解:看了题之后觉得肯定是DP ...

  7. 队爷的新书 CH Round #59 - OrzCC杯NOIP模拟赛day1

    题目:http://ch.ezoj.tk/contest/CH%20Round%20%2359%20-%20OrzCC杯NOIP模拟赛day1/队爷的新书 题解:看到这题就想到了 poetize 的封 ...

  8. CH Round #58 - OrzCC杯noip模拟赛day2

    A:颜色问题 题目:http://ch.ezoj.tk/contest/CH%20Round%20%2358%20-%20OrzCC杯noip模拟赛day2/颜色问题 题解:算一下每个仆人到它的目的地 ...

  9. CH Round #52 - Thinking Bear #1 (NOIP模拟赛)

    A.拆地毯 题目:http://www.contesthunter.org/contest/CH%20Round%20%2352%20-%20Thinking%20Bear%20%231%20(NOI ...

随机推荐

  1. 转:基础篇|PHP如何解决网站大流量和高并发

    基础篇 高并发架构基础概念和优化思路 高并发架构相关概念 并发,在操作系统中,是指一个时间段中有几个程序都处于已启动运行到运行完毕之间,且这几个程序都是在同一个处理机上运行,但任一个时刻点上只有一个程 ...

  2. One-Hot独热编码

    One-Hot独热编码 Dummy Encoding VS One-Hot Encoding二者都可以对Categorical Variable做处理,定性特征转换为定量特征,转换为定量特征其实就是将 ...

  3. 洛谷P3102 [USACO14FEB]秘密代码Secret Code

    P3102 [USACO14FEB]秘密代码Secret Code 题目描述 Farmer John has secret message that he wants to hide from his ...

  4. Oracle表连接(转)

    表之间的连接 Join是一种试图将两个表结合在一起的谓词,一次只能连接2个表,表连接也可以被称为表关联.在后面的叙述中,我们将会使用”row source”来代替”表”,因为使用row source更 ...

  5. JDK动态代理和cglib代理

    写一个简单的测试用例,Pig实现了Shout接口 public class MyInvocation implements InvocationHandler { Object k; public M ...

  6. spark_learn

    package chapter03 import org.apache.spark.sql.DataFrame import org.apache.spark.sql.hive.HiveContext ...

  7. ZC01

    1.苏州市住房公积金管理中心 http://www.szgjj.gov.cn/szgjj/ 2.苏州社保 http://www.szsbzx.net.cn:9900/web/website/index ...

  8. c++的直接初始化与复制初始化 未完成!!!!!!!!!!!!

    直接初始化:是直接调用类的构造函数进行初始化.如下: string a;//调用默认构造函数 string a("hello");//调用参数为 const char* 类型的构造 ...

  9. vi 编辑器的复制

    v 进入可视化模式,y  复制选中区域,p粘贴 Ctrl + v 块模式 yy 复制当前行

  10. phpize使用方法

    phpize是用来扩展php扩展模块的,通过phpize可以建立php的外挂模块,下面介绍一个它的使用方法,需要的朋友可以参考下 安装(fastcgi模式)的时候,常常有这样一句命令: 代码如下: / ...