http://www.codechef.com/NOV13 还在比...我先放一部分题解吧...

Uncle Johny 排序一遍

struct node{
int val;
int pos;
}a[MAXN];
int cmp(node a,node b){
return a.val < b.val;
}
int main(){
int T,n,m;
while(cin>>T){
while(T--){
cin>>n;
for(int i = ; i < n ; i++){
cin>>a[i].val;
a[i].pos = i+;
}
cin>>m;
sort(a,a+n,cmp);
for(int i = ; i < n ; i++){
if(a[i].pos == m){
cout<<i+<<endl;
break;
}
}
}
}
return ;
}

Missing some chairs 简单快速幂

LL pow_mod(LL a, LL b){
if(b == ) return a;
LL x = pow_mod(a,b/),ret;
if(b&){
ret = ((x * x)%MOD * a) % MOD;
}else ret = (x * x) % MOD;
return ret;
}
int main(){
int T;
cin>>T;
while(T--){
LL n;
cin>>n;
LL c = pow_mod(,n);
cout<<c-<<endl;
}
return ;
}

Yet Another Cute Girl

因子个数为素数的可能只有可能是pi^(pj-1)次幂..其中p是素数

对于pj=2,区间素数筛,筛到sqrt(N)就行了...有O(n)的做法但我懒得写...其他的情况直接处理[L,R]内pi^(pj-1)的个数,加起来即可...

考虑到pow可能爆LL,这个很坑..我应该是卡过的...

LL cnt;
bool prime[MAXN];
LL pri[MAXN];
bool p[MAXN];
LL L,R;
void pre_prime(){
cnt = ;
prime[] = prime[] = ;
for(int i = ; i < MAXN ; i++){
if(!prime[i]) pri[cnt++] = i;
for(int j = ; j < cnt && i * pri[j] <= MAXN ; j++){
prime[i * pri[j]] = ;
if(i % pri[j] == ) break;
}
}
}
LL mpow(LL a, LL b){
LL ret = ;
for(LL i = ; i < b ; i++){
LL tmp = ret * a;
if(tmp > LINF || tmp < ret) return -;
ret = tmp;
}
return ret;
}
LL solve(){
LL ct = ;
mem(p,);
for(LL i = ; i < cnt ; i++){
for(LL j = ; j < cnt ; j++){
LL q = mpow(pri[j],pri[i]-);
if(q == -) break;
if(q >= L && q <= R){
ct++;
}
}
}
for(LL j = ; j < cnt ; j++){
LL i;
L % pri[j] == ? i = L : i = (L/pri[j]+)*pri[j];
if(i < MAXN && prime[i] == ) i = i*;
for(i ; i <= R ; i+=pri[j]) p[i-L] = true;
}
for(LL i = L ; i <= R ; i++){
if(p[i-L] == false && i != ){
ct++;
}
}
return ct;
}
int main(){
pre_prime();
int T;
cin>>T;
while(T--){
cin>>L>>R;
LL res = solve();
cout<<res<<endl;
}
return ;
}

Square Digit Squares 预处理一遍完全平方数,就没多少个

LL a[MAXN];
int cnt = ;
bool judge(LL x){
while(x){
LL y = x%;
if(y != && y != && y != && y != ) return false;
x/=;
}
return true;
}
void pre(){
for(LL i = ; i*i <= (LL)pow((LL),(LL))+ ; i++){
if(judge(i*i)){
a[cnt++] = i*i;
}
}
}
int main(){
pre();
int T;
cin>>T;
while(T--){
LL ax,bx;
cin>>ax>>bx;
int ct = ;
for(int i = ; i < cnt ; i++)
if(a[i] >= ax && a[i] <= bx) ct++;
cout<<ct<<endl;
}
return ;
}

Superpowers of 2 还是幂取模,一套题出两次我就不吐槽了,也许LL会WA

ULL change(ULL a){
ULL ret = ;
int p[],cnt = ;
while(a){
p[cnt++] = a%;
a/=;
}
for(int i = cnt- ; i >= ; i--){
ret = ret * + p[i];
}
return ret;
}
ULL pow_mod(ULL a, ULL b){
if(b == ) return a;
ULL x = pow_mod(a,b/),ret;
if(b&) ret = ((x * x)%MOD * a) % MOD;
else ret = (x * x) % MOD;
return ret;
}
int main(){
int T;
cin>>T;
while(T--){
int n;
cin>>n;
ULL x = pow_mod(,change(n));
cout<<(x*x)%MOD<<endl;
}
return ;
}

CodeChef November Challenge 2013 部分题解的更多相关文章

  1. CodeChef November Challenge 2019 Division 1题解

    传送门 AFO前的最后一场CC了--好好打吧-- \(SIMGAM\) 偶数行的必定两人平分,所以只要抢奇数行中间那个就行了 这题怎么被爆破了 //quming #include<bits/st ...

  2. codechef February Challenge 2018 简要题解

    比赛链接:https://www.codechef.com/FEB18,题面和提交记录是公开的,这里就不再贴了 Chef And His Characters 模拟题 Chef And The Pat ...

  3. codechef January Challenge 2017 简要题解

    https://www.codechef.com/JAN17 Cats and Dogs 签到题 #include<cstdio> int min(int a,int b){return ...

  4. [Codechef November Challenge 2012] Arithmetic Progressions

    题意:给定一个序列,求多少个三元组满足ai+ak=2*aj(i<j<k). 题解:原来叉姐的讲义上有啊..完全忘掉了.. 首先这个式子很明显是一个卷积.我们有了FFT的思路.但是肯定不能每 ...

  5. 【分块+树状数组】codechef November Challenge 2014 .Chef and Churu

    https://www.codechef.com/problems/FNCS [题意] [思路] 把n个函数分成√n块,预处理出每块中各个点(n个)被块中函数(√n个)覆盖的次数 查询时求前缀和,对于 ...

  6. Codechef November Challenge 2019 Division 1

    Preface 这场CC好难的说,后面的都不会做QAQ 还因为不会三进制位运算卷积被曲明姐姐欺负了,我真是太菜了QAQ PS:最后还是狗上了六星的说,期待两(三)场之内可以上七星 Physical E ...

  7. CodeChef November Challenge 2014

    重点回忆下我觉得比较有意义的题目吧.水题就只贴代码了. Distinct Characters Subsequence 水. 代码: #include <cstdio> #include ...

  8. Codechef April Challenge 2019 游记

    Codechef April Challenge 2019 游记 Subtree Removal 题目大意: 一棵\(n(n\le10^5)\)个结点的有根树,每个结点有一个权值\(w_i(|w_i\ ...

  9. Codechef October Challenge 2018 游记

    Codechef October Challenge 2018 游记 CHSERVE - Chef and Serves 题目大意: 乒乓球比赛中,双方每累计得两分就会交换一次发球权. 不过,大厨和小 ...

随机推荐

  1. mysql-联结

    一.联结 联结是利用SQL的select能执行的最重要的操作. 1.关系表:假如有一个包含产品目录的数据库表,其中每个类别的物品占一行.对于每种物品要求存储的信息包括产品描述和价格,以及生产该产品的供 ...

  2. 福利贴——爬取美女图片的Java爬虫小程序代码

    自己做的一个Java爬虫小程序 废话不多说.先上图. 目录命名是用标签缩写,假设大家看得不顺眼能够等完成下载后手动改一下,比方像有强迫症的我一样... 这是挂了一个晚上下载的总大小,只是还有非常多由于 ...

  3. 编写SDR SDRAM页突发模式控制器的注意点

    网上有很多的SDR SDRAM控制器的代码,但都是基于burst1/2/4/8模式下的,这种模式下传输高速的相机数据还是有点拮据的,所以花了几天把这些模式改造成了页突发模式.我的这个控制器模型是这样的 ...

  4. 51nod-1189: 阶乘分数

    [传送门:51nod-1189] 简要题意: 给出一个数n,求出有多少个正整数x,y(0<x<=y)满足$1/n!=1/x+1/y$ 题解: 一开始还以为不可做 结果推一下柿子就会了 $1 ...

  5. struts2 validate验证

    转自:https://blog.csdn.net/houpengfei111/article/details/9038233 自定义拦截器 要自定义拦截器需要实现com.opensymphony.xw ...

  6. android取高度

    Rect rect = new Rect();  getWindow().getDecorView().getWindowVisibleDisplayFrame(rect);  int top = r ...

  7. OpenGL编程(五)绘直线以及分析绘直线的算法

    这次主要实现在窗口上绘制点.线以及修改其属性,另外还会分析画直线的原理和相关算法. 1.在窗口指定位置画点 glBegin(GL_POINTS); glEnd(); 使用glBegin()和glEnd ...

  8. 深入理解 sudo 与 su 之间的区别

    深入理解 sudo 与 su 之间的区别 作者: Himanshu Arora 译者: LCTT zhb127 在早前的一篇文章中,我们深入讨论了 sudo 命令的相关内容.同时,在该文章的末尾有提到 ...

  9. python 进阶:修饰器的介绍

    参考链接:Python 函数装饰器 我认为python中的装饰器是一个很厉害的功能,他能瞬间提升代码的逼格,但对于我这样的小白来说,别说为所欲为的使用了,就连简单的尝试一下,却也是难于登天.经过长达半 ...

  10. caioj 1076 动态规划入门(中链式3:最大的算式)

    一开始写了一个复杂度很大的方法,然后还过了(千万记得开longlong ) #include<cstdio> #include<cstring> #include<alg ...