#include<bits/stdc++.h>
#define int long long
using namespace std;
const int maxn=1e6+;
const int mod=1e9+;
int dp[maxn][];
int quick(int a,int n)
{
int ans=;
int x=a;
while(n!=)
{
if(n%==) {ans=ans%mod*x%mod; n--; }
else { x=x%mod*x%mod;n=n/; }
}
return ans%mod;
}
int32_t main()
{
int T; cin>>T;
while(T--)
{
memset(dp,,sizeof(dp));
int n,k; cin>>n>>k;
k=quick(,k);
dp[][]=k%mod;//
dp[][]=;// qi ta
dp[][]=;// bu neng de
for(int i=;i<=n;i++)
{
dp[i][]=dp[i-][]%mod+dp[i-][]%mod;
dp[i][]=dp[i-][]*(k-)+dp[i-][]*(k-)%mod+dp[i-][]*(k-)%mod;
dp[i][]=dp[i-][]%mod+dp[i-][]%mod;
dp[i][]=dp[i][]%mod;
dp[i][]=dp[i][]%mod;
dp[i][]=dp[i][]%mod;
// cout<<dp[i][0]<<" "<<dp[i][1]<<" "<<dp[i][2]<<endl;
}
cout<<(dp[n][]+dp[n][])%mod<<endl;
}
}

A.cpp

#include<bits/stdc++.h>
using namespace std;
int main()
{
int T; scanf("%d",&T);
while(T--)
{
map<pair<int,int>,int> mp;
map<pair<int,int>,int> tf;
int num; scanf("%d",&num);
int ans=;
for(int i=;i<=num;i++)
{
int k; scanf("%d",&k);
for(int j=;j<=k;j++)
{
int a,b; scanf("%d %d",&a,&b);
if(tf[{a,b}]==i) continue;
if(tf[{a,b}]==i-)
{
tf[{a,b}]=i;
mp[{a,b}]++;
if(mp[{a,b}]>ans) ans=mp[{a,b}];
}
else
{
tf[{a,b}]=i;
mp[{a,b}]=;
if(mp[{a,b}]>ans) ans=mp[{a,b}];
}
}
}printf("%d\n",ans);
}
}

F.cpp

#include<bits/stdc++.h>
using namespace std;
int main()
{
int T; cin>>T;
while(T--)
{
int n; char z;
cin>>n>>z;
string ss; cin>>ss;
int ans=;
int t=;
for(int i=;i<n;i++)
{
int k=abs(z-ss[i]);
if(t==)
{
if(k==) continue;
else
{
if(k<) ans+=;
else if(k<) ans+=;
else if(k<) ans+=; }
t=;
}
else if(t==) ans+=;
}
if(ans==) ans=;
cout<<ans<<endl;
}
}

I.cpp

ACM-ICPC 2018 徐州赛区网络预赛(9.9)的更多相关文章

  1. ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心)

    ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心) Trace 问答问题反馈 只看题面 35.78% 1000ms 262144K There's a beach in t ...

  2. ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer (最大生成树+LCA求节点距离)

    ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer J. Maze Designer After the long vacation, the maze designer ...

  3. 计蒜客 1460.Ryuji doesn't want to study-树状数组 or 线段树 (ACM-ICPC 2018 徐州赛区网络预赛 H)

    H.Ryuji doesn't want to study 27.34% 1000ms 262144K   Ryuji is not a good student, and he doesn't wa ...

  4. ACM-ICPC 2018 徐州赛区网络预赛 B(dp || 博弈(未完成)

    传送门 题面: In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl n ...

  5. ACM-ICPC 2018 徐州赛区网络预赛 B. BE, GE or NE

    In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named &qu ...

  6. ACM-ICPC 2018 徐州赛区网络预赛 H. Ryuji doesn't want to study

    262144K   Ryuji is not a good student, and he doesn't want to study. But there are n books he should ...

  7. ACM-ICPC 2018 徐州赛区网络预赛 F. Features Track

    262144K   Morgana is learning computer vision, and he likes cats, too. One day he wants to find the ...

  8. ACM-ICPC 2018 徐州赛区网络预赛 I. Characters with Hash

    Mur loves hash algorithm, and he sometimes encrypt another one's name, and call him with that encryp ...

  9. ACM-ICPC 2018 徐州赛区网络预赛 D 杜教筛 前缀和

    链接 https://nanti.jisuanke.com/t/31456 参考题解  https://blog.csdn.net/ftx456789/article/details/82590044 ...

  10. ACM-ICPC 2018 徐州赛区网络预赛(8/11)

    ACM-ICPC 2018 徐州赛区网络预赛 A.Hard to prepare 枚举第一个选的,接下来的那个不能取前一个的取反 \(DP[i][0]\)表示选和第一个相同的 \(DP[i][1]\) ...

随机推荐

  1. Linux command automake

    Linux command automake [Purpose]        Learning linux command automake for generate Makefile.in for ...

  2. 尚学堂java 答案解析 第六章

    本答案为本人个人编辑,仅供参考,如果读者发现,请私信本人或在下方评论,提醒本人修改 一.选择题 1.C 解析:对void下的函数,可以使用"return;"表示结束之意,但不能&q ...

  3. core net 2 nuget的数据源包

    基本都是 在 obj里面 debug里面 porgect.assetc.json

  4. SWAP 简介

    swap 交换分区,是存放在内存当中的临时数据(断电数据丢失) SWAP作用:当内存不足时会导致系统挂了,SWAP就是起到一个临时内存的作用,当内存不足时SWAP充当临时内存,防止系统挂掉

  5. Android开发 --代码布局

    Android开发 --代码布局 在线性布局LinearLayout里加入view比较简单,因为属性比较少,布局简单 示例,加入一个TextView LinearLayout layout = (Li ...

  6. tensorflow-LSTM-网络输出与多隐层节点

    本文从tensorflow的代码层面理解LSTM. 看本文之前,需要先看我的这两篇博客 https://www.cnblogs.com/yanshw/p/10495745.html 谈到网络结构 ht ...

  7. vue-cli快速构建vue项目模板

    vue-cli 是vue.js的脚手架,用于自动生成vue.js模板工程的. 1.使用npm安装vue-cli 需要先装好vue 和 webpack(前提是已经安装了nodejs,否则连npm都用不了 ...

  8. <Spark><Running on a Cluster>

    Introduction 之前学习的时候都是通过使用spark-shell或者是在local模式运行spark 这边我们首先介绍Spark分布式应用的架构,然后讨论在分布式clusters中运行Spa ...

  9. pytest 的 yield

    前言:1.当 pytest.fixture(scope="module") 时,pytest的yieId 类似unittest的teartownclass 2.当 pytest.f ...

  10. mysql储存引擎

    Mysql数据库常用存储引擎 数据库存储引擎:是数据库底层软件组织,数据库管理系统(DBMS)使用数据引擎进行创建.查询.更新和删除数据.不同的存储引擎提供不同的存储机制.索引技巧.锁定水平等功能,使 ...