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. 简单搭建zookeeper集群分布式/伪分布式

    分布式搭建 一.下载zookeeper安装包 自行下载:我用的是 zookeeper-3.5.4-beta.tar.gz 二.环境准备 1. 我的虚拟机自带的java是1.7的,这个版本要求java1 ...

  2. 洛谷 P3662 [USACO17FEB]Why Did the Cow Cross the Road II S

    P3662 [USACO17FEB]Why Did the Cow Cross the Road II S 题目描述 The long road through Farmer John's farm ...

  3. _stat函数/struct stat 结构体使用笔记

    内容来自互联网,非原创,方便以后查看. 另,关于获取文件信息——_stat函数的使用详见 http://blog.csdn.net/frank_liuxing/article/details/1860 ...

  4. [Angular] Short Imports with TypeScript Path Mapping

    The idea is change from: import {CoreModule} from '../core/core.module'; to: import {CoreModule} fro ...

  5. 【Codeforces】512C Fox and Dinner

    [解析]欧拉筛法,奇偶分析.建二分图,网络流 [Analysis] http://blog.csdn.net/qq574857122/article/details/43453087. 所谓的连通块就 ...

  6. Android学习路线(十二)Activity生命周期——启动一个Activity

    DEMO下载地址:http://download.csdn.net/detail/sweetvvck/7728735 不像其他的编程模式那样应用是通过main()函数启动的.Android系统通过调用 ...

  7. BZOJ 2124 线段树维护hash值

    思路: http://blog.csdn.net/wzq_QwQ/article/details/47152909 (代码也是抄的他的) 自己写得垃圾线段树怎么都过不了 隔了两个月 再写 再挂 又隔了 ...

  8. spring-data-redis 使用过程中需要注意的地方

    1.序列化问题 <!-- SDR默认采用的序列化策略有两种,一种是String的序列化策略,一种是JDK的序列化策略. StringRedisTemplate默认采用的是String的序列化策略 ...

  9. RelativeLayout中的baseline

    比如,加入两个相邻的TextView,给第二个TextView一个大一点的padding(比如20dp),如果加了layout_alignBaseline到第二个TextView中的话, TextVi ...

  10. 存储过程的调用和Parameters数组的调用

    记录一些杂记吧 declare @d datetime set @d=GETDATE() select * from [ACC_B2B].[dbo].ORDER_Head --where 1=1 se ...