#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. am335x system upgrade uboot ethernet(二)

    系统可以通过SD卡引道之后,为了之后了调试方便 通过查看网卡的硬件设计 正常来说需要注意的有如下几点: 1) 网口 的接线方式: RMII 2) 网口的PHY地址两张网口,这里我们只需先初始化一张网卡 ...

  2. day05_python_1124

    ---恢复内容开始--- 改l1[1:4:2]=[1:32]   对于增加个数 列表按切片取就是列表 ---恢复内容结束--- 01 昨日内容回顾 list: 增: append insert(ind ...

  3. java字符串根据空格截取并存进ArrayList,并在每个元素前后加上/

    public class List { public static void main(String[] args) { String s = "abc nnn ooo/xzsxc bs&q ...

  4. Kafka.net使用编程入门(一)

    最近研究分布式消息队列,分享下! 首先zookeeper  和 kafka 压缩包 解压 并配置好! 我本机zookeeper环境配置如下: D:\Worksoftware\ApacheZookeep ...

  5. day12 生成器和各种推导式

    今天主要学习了 1.生成器 2.生成器函数 3.各种推导式(比较诡异,理解了很简单,不理解很难) 4.生成器表达式(重点) 一.生成器 def func(): print'我叫周润发' return ...

  6. 八. Python基础(8)--函数

    八. Python基础(8)--函数 1 ● 函数返回布尔值 注意, 自定义的函数也可以是用来作逻辑判断的, 例如内置的startswith()等函数. def check_len(x):     ' ...

  7. HTTPS加密原理(转)

    Header HTTP.HTTPS在我们日常开发中是经常会接触到的. 我们也都知道,一般 Android 应用开发,在请求 API 网络接口的时候,很多使用的都是 HTTP 协议:使用浏览器打开网页, ...

  8. Java语法基础学习DayTwo

    一.数据类型补充问题 数据类型的自动转换等级: byte,short,char -- int -- long -- float -- double long是8个字节,float是4个字节,为什么是这 ...

  9. Ubuntu配置静态IP

    1. 输入命令:sudo vi /etc/network/interfaces 编辑文件: auto lo iface lo inet loopback auto eth0 iface eth0 in ...

  10. windwos7 vnc连接centos6.6

    一.先配置centos6.6的vnc(已经安装过桌面) #yum  install  fontforge -y   防止字体乱码 #yum tigervnc tigervnc-server -y   ...