思路:20%可以搜索。。

 #include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<iostream>
#include<time.h>
#define ll long long
const ll Mod=;
ll jc[],jcny[];
int n,m;
int read(){
char ch=getchar();int t=,f=;
while (ch<''||ch>''){if (ch=='-') f=-;ch=getchar();}
while (''<=ch&&ch<=''){t=t*+ch-'';ch=getchar();}
return t*f;
}
ll gcd(ll a,ll b){
if (b==) return a;
else return gcd(b,a%b);
}
void exgcd(ll a,ll b,ll &x,ll &y){
if (b==){
x=;
y=;
return;
}
exgcd(b,a%b,x,y);
ll t=x;
x=y;
y=t-a/b*y;
}
void init(){
jc[]=;
for (int i=;i<=;i++)
jc[i]=(jc[i-]*i)%Mod;
ll x,y;
exgcd(jc[],Mod,x,y);
jcny[]=x;
for (int i=;i>=;i--)
jcny[i]=(jcny[i+]*(i+))%Mod;
}
ll Pow(ll x,ll y){
ll res=;
while (y){
if (y%) res=(res*x)%Mod;
y/=;
x=(x*x)%Mod;
}
return res;
}
ll A(int n,int m){
return jc[n]*jcny[n-m];
}
ll C(int n,int m){
return (((jcny[m]*jcny[n-m])%Mod)*jc[n])%Mod;
}
bool superjudge(){
if (n==) {printf("1\n");return ;}
if (n==) {printf("%lld\n",(((*Pow(,m))%Mod+(*Pow(,m))%Mod)%Mod));return ;}
if (n==) {printf("%lld\n",((*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod)%Mod);return ;}
if (n==) {printf("%lld\n",((*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))+(*Pow(,m))%Mod));return ;}
if (n==) {printf("%lld\n",((*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod)%Mod);return ;}
if (n==) {printf("%lld\n",((*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod)%Mod);return ;}
if (n==) {printf("%lld\n",((*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m))%Mod+(*Pow(,m)))%Mod);return ;}
return ;
}
ll Rand(){
ll t=(ll)(rand()*rand())%Mod;
return t;
}
int main(){
freopen("dark.in","r",stdin);
freopen("dark.out","w",stdout);
srand(time(NULL));
int T=read();
init();
while (T--){
n=read();m=read();
if (n<=&&superjudge()) continue;
if (n==&&m==) printf("33703375\n");
else
printf("%lld\n",Rand());
}
}

40%算法

BZOJ NOI十连测 第二测 T2的更多相关文章

  1. BZOJ NOI十连测 第一测 T2

    思路:看到这题,就感觉是一道很熟悉的题目: http://www.cnblogs.com/qzqzgfy/p/5535821.html 只不过这题的K最多可以到N,而且边权不再只是1,考试的时候yy了 ...

  2. BZOJ NOI十连测 第二测 T1

    出题人居然是个哲学家.. 26%的程序,太SB了...本来我的想法也是二分+贪心,但是贪心是个怪怪的SX贪心.. #include<algorithm> #include<cstdi ...

  3. BZOJ NOI十连测 第一测 T1

    思路:首先考虑t=1的情况,t等于1,那么所有位置的颜色相同,我们不用考虑概率的问题,那么,k+d*x在模d下都相等,我们考虑预处理一个数组s[i][j],代表d为i,起始位置为j的等差数列的和,这个 ...

  4. 痞子衡嵌入式:测一测i.MXRT1170 Raw NAND启动时间(从POR到进App的Reset_Handler)

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是恩智浦i.MX RT1170 Raw NAND启动时间. 关于i.MXRT1170这颗划时代的MCU,痞子衡去年10月在其刚发布的时候, ...

  5. 「NOI十联测」深邃

    「NOI十联测」深邃 要使得最大的连通块最小,显然先二分答案. 先固定1结点为根. 对于一个果实,显然是先处理子树中未分配的点,再向外延伸. 每个结点记录一个\(si[]\),表示子树中未分配的点数, ...

  6. 「NOI十联测」奥义商店

    「NOI十联测」奥义商店 若lzz想花费最少的钱,那么显然要选择数目较少的颜色. 先考虑暴力的写法. 每次向两边统计,每个物品要求被买的概率可以由上一个物品推出. now=1;//now 被买概率 M ...

  7. 「NOI十联测」黑暗

    「NOI十联测」黑暗 \(n\) 个点的无向图,每条边都可能存在,一个图的权值是连通块个数的 \(m\) 次方,求所有可能的图的权值和.(n≤30000,m≤15) 令\(ans[n][m]\)为n个 ...

  8. NOI十连测 第五测 T2

    思路:考虑建立可持久化线段树,第一层维护的是i这个位置的next位置,第二层,维护的是接下来走这个字符会到哪个节点. 感觉很巧妙啊,不愧是Claris #include<algorithm> ...

  9. NOI十连测 第四测 T2

    思路:线段树套可持久化treap,可持久化treap我还是第一次听说.. 改题的时候没看数据范围..乱开数组T_T #include<algorithm> #include<cstd ...

随机推荐

  1. javascript----bug

    JSON.parse(null)------------某些手机浏览器不支持.

  2. Ubuntu 14.04远程登录服务器--openssh的安装和配置简明步骤

    如果要主机通过网络操作嵌入式板子,ttelnet就够了,但是 如果要相互传文件,则必须使用另外一个强大的软件SSH.更完整的步骤和截图请参考http://jingyan.baidu.com/artic ...

  3. GetSystemTime API可以得到毫秒级时间

    用Now返回的日期格式中年只有2位,即2000年显示为00, 这似乎不太令人满意. 此外Now和Time都只能获得精确到秒的时间,为了得到更精确的毫秒级时间,可以使用API函数GetSystemTim ...

  4. EBS查找运行请求时间,参数等

    --查找运行请求时间,参数等(可以是某用户的,某个报表) select c.user_name, papf.full_name, b.user_concurrent_program_name, a.r ...

  5. 《Java程序员面试笔试宝典》之Java变量命名有哪些规则

    在Java语言中,变量名.函数名.数组名统称为标识符,Java语言规定标识符只能由字母(a~z,A~Z).数字(0~9).下划线(_)和$组成,并且标识符的第一个字符必须是字母.下划线或$.此外,标识 ...

  6. poj 3684 Physics Experiment(数学,物理)

    Description Simon ), the first ball is released and falls down due to the gravity. After that, the b ...

  7. [Javascript]3. Improve you speed! Performance Tips

    /** Let inheritance help with memory efficiency */ function SignalFire(ID, startingLogs){ this.fireI ...

  8. [Regex Expression] Tagline --- {0, } {1,10}

    Using a character set repeated 1 or more times, make a pattern to search for strings that do not con ...

  9. [HeadFirst-HTMLCSS学习笔记][第三章创建网页]

    一些基本元素 以下元素都可以用CSS变得更好看 q,<blockquote>,<em>,<br>, <strong>,ol ,ul,li,pre,cod ...

  10. Android Eclipse Errors

    1.The import org.apache.http.client; tip: cannot be resolved; resolve: Find library in your sdk and ...