#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. WINDOWS 端口查看

    查看Windows下所有使用的端口 netstat -ano 查看Windows下某一个特定的端口 netstat -ano | find "8080"   查看windows下所 ...

  2. Win10系列:C#应用控件基础1

    Button控件 在Windows应用商店应用的开发中,Button控件是使用比较频繁的控件之一,当用户单击Button控件时,会触发相应的单击事件并在定义好的事件处理方法中执行指定的功能.下面将介绍 ...

  3. Win10系列:UWP界面布局进阶5

    提示框 在Windows应用商店应用程序中可以使用提示框来向用户显示提示信息,例如可以通过对话框来询问用户当前需要执行的操作,还可以通过弹出窗口来显示需要注意的信息.本节将向读者介绍如何在Window ...

  4. centos6.5 安装php-5.6.31

    1 从PHP官网下载所需要的PHP版本 下载地址:  http://php.net/get/php-5.6.31.tar.gz/from/a/mirror  把下载好的文件上传到服务器 2 安装PHP ...

  5. xadmin自定义关联菜单

    网上好多自定义xadmin后台数据很少有关怎样设置外键关联菜单的显示,如下图所示: 现有个需求根据model中status字段值,来显示关联菜单三道杠,如上图app状态只有是审核成功才会显示,未审核不 ...

  6. [Codeforces797F]Mice and Holes

    Problem n个老鼠,m个洞,告诉你他们的一维坐标和m个洞的容量限制,问最小总距离. Solution 用dp[i][j]表示前i个洞,进了前j个老鼠的最小代价 dp[i][j]=min(dp[i ...

  7. Java并发编程_volatile关键字的用法(二)

    被volatile修饰的变量能够保证每个线程能够获取该变量的最新值,从而避免出现数据脏读的现象. 根据下面实例理解: package sync; public class VolatileTest e ...

  8. SpringBoot + JPA 连接MySQL完整实例(一)

    开发工具 1.Eclipse 2.Maven 3.Spring Boot 首先,Eclipse中配置好maven,具体请百度 工程结构: 实现步骤: 1.Eclipse中新建一个maven proje ...

  9. vue-3-Class 与 Style 绑定

    对象语法: <div v-bind:class="{ active: isActive }"></div> <div class="stat ...

  10. Centos7防范SYN

    我们这里应用的是CentOS5.3,并内核使用的是2.6.18-128.el5PAE #1 SMP .修改部分TCP ,有的是为了提高性能与负载,但是存在降低稳定性的风险.有的则是安全方面的配置,则有 ...