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. Docker学习总结(11)——八个Docker的真实应用场景

    [编者的话]Flux 7介绍了常用的8个Docker的真实使用场景,分别是简化配置.代码流水线管理.提高开发效率.隔离应用.整合服务器.调试能力.多租户环境.快速部署.我们一直在谈Docker,Doc ...

  2. CentOS6.3从光盘安装gcc(更改yum源)[转]

    转自:http://www.linuxidc.com/Linux/2012-11/73826.htm 一.加载光盘镜像 加载本地bin-DVD镜像文件到虚拟机系统,如图所示: 二.更改yum源 1.挂 ...

  3. 继续过Hard题目.周五

      # Title Editorial Acceptance Difficulty Frequency   . 65 Valid Number     12.6% Hard    . 126 Word ...

  4. Android 开发者不得不面对的六个问题

    一份关于移动应用开发的调查报告显示,Androdid开发者对谷歌的移动操作系统平台的兴趣正在下降.尽管依然有79%的开发者表示对Android “非常感兴趣”,但调查报告显示,一些迹象表明在2012到 ...

  5. BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第10章节--SP2013中OAuth概览 创建和管理应用程序身份

    BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第10章节--SP2013中OAuth概览  创建和管理应用程序身份         在之前的部分.你看到应用程序怎样像用 ...

  6. Eval函数知识总结

    说道Json,我们先来聊聊eval 一.eval是什么?(解析器) eval是一个函数,看本质function  eval() { [native code] } 二.怎样使用eval? 语法:str ...

  7. BZOJ 1391 网络流

    vis[0]没有清零查一年- //By SiriusRen #include <cstdio> #include <cstring> #include <algorith ...

  8. POJ 1151 线段树+扫描线

    题意:求矩形面积的并 思路: 注意是[l,mid][mid,r] 这是真正的线段了 就当扫描线模板使吧~ //By SiriusRen #include <cmath> #include ...

  9. 一些 <link> 标记分享

    <link rel="alternate" media="handheld" href="#" /> <link rel= ...

  10. [USACO08DEC]拍头Patting Heads 水题

    类似素数筛,暴力可过,不需要太多的优化 Code: #include<cstdio> #include<algorithm> #include<string> us ...