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. C/C++ ShellExecuteEx调用exe可执行文件

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/49591995 以商业的软件Enblen ...

  2. POJ——T 3020 Antenna Placement

    http://poj.org/problem?id=3020 Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9844   A ...

  3. less12 函数

    less .x(1) { x:11 } .x(2) { y:22 } .x(@x:1) when (default()) {z:@x} //default()表示一直为真 body{ backgrou ...

  4. hdoj--2282--Chocolate(最小费用)

    Chocolate Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  5. poj--2083--Fractal(dfs)

    Fractal Time Limit: 1000MS   Memory Limit: 30000KB   64bit IO Format: %I64d & %I64u Submit Statu ...

  6. [poj 2912] Rochambeau 解题报告 (带权并查集)

    题目链接:http://poj.org/problem?id=2912 题目: 题目大意: n个人进行m轮剪刀石头布游戏(0<n<=500,0<=m<=2000) 接下来m行形 ...

  7. DSU

    DSU stands for ‘decorate, sort, undecorate’ and refers to a pattern that is often useful for sorting ...

  8. 18.查询效率最高的unordered_map

    #include <string> #include <iostream> //查询性能最高 //增删查改与map是一样的,但是本质区别就是unordered_map底层是ha ...

  9. Hadoop框架基础(二)

    ** Hadoop框架基础(二) 上一节我们讨论了如何对hadoop进行基础配置已经运行一个简单的实例,接下来我们尝试使用eclipse开发. ** maven安装 简单介绍:maven是一个项目管理 ...

  10. Lumia 1520 IE mobile window.devicePixelRatio

    Lumia 1520 IE11 mobile -> window.devicePixelRatio = 2.217964285714286 Lumia 1520 UAP 环境 -> win ...