ACM-ICPC 2018 徐州赛区网络预赛(9.9)
#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)的更多相关文章
- ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心)
ACM-ICPC 2018 徐州赛区网络预赛 G. Trace (思维,贪心) Trace 问答问题反馈 只看题面 35.78% 1000ms 262144K There's a beach in t ...
- ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer (最大生成树+LCA求节点距离)
ACM-ICPC 2018 徐州赛区网络预赛 J. Maze Designer J. Maze Designer After the long vacation, the maze designer ...
- 计蒜客 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 ...
- ACM-ICPC 2018 徐州赛区网络预赛 B(dp || 博弈(未完成)
传送门 题面: In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl n ...
- 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 ...
- 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 ...
- ACM-ICPC 2018 徐州赛区网络预赛 F. Features Track
262144K Morgana is learning computer vision, and he likes cats, too. One day he wants to find the ...
- 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 ...
- ACM-ICPC 2018 徐州赛区网络预赛 D 杜教筛 前缀和
链接 https://nanti.jisuanke.com/t/31456 参考题解 https://blog.csdn.net/ftx456789/article/details/82590044 ...
- ACM-ICPC 2018 徐州赛区网络预赛(8/11)
ACM-ICPC 2018 徐州赛区网络预赛 A.Hard to prepare 枚举第一个选的,接下来的那个不能取前一个的取反 \(DP[i][0]\)表示选和第一个相同的 \(DP[i][1]\) ...
随机推荐
- day06字典类型
基本使用: 1.用途:用来存多个(不同种类的)值 2定义方式:在{}内用逗号分隔开多个key:value的元素,其中value可以是任意数据类型,而key的功能通常是用来描述value的,所以key通 ...
- 洛谷 P4515 [COCI2009-2010#6] XOR
题意 平面直角坐标系中有一些等腰直角三角形,且直角边平行于坐标轴,直角顶点在右下方,求奇数次被覆盖的面积.N<=10.输入为x,y,r,分别表示三角形顶点的坐标与三角形的边长. 如: 总面积为0 ...
- MYSQL基础知识小盲区
MYSQL必会的知识 命令行 启动mysql: mysql -u用户名 -p密码 显示表中的各列详细信息: show columns form tablename 等价于 desc ...
- Xcode清理存储空间
文章来自 枣泥布丁 http://www.cocoachina.com/ios/20170711/19814.html 请针对性的选择删除 移除 Xcode 运行安装 APP 产生的缓存文件(Deri ...
- JDK(java se development kit)的构成
1.javac(Java compiler)编译器 通过命令行输入javac命令调用Java编译器,编译Java文件的过程中,javac会检查源程序是否符合Java的语法,没有语法 问题就会将.jav ...
- yaw roll pitch matrix
http://planning.cs.uiuc.edu/node102.html http://planning.cs.uiuc.edu/node103.html
- hdu5335(bfs,贪心)
In an n∗mn∗m maze, the right-bottom corner is the exit (position (n,m)(n,m) is the exit). In every p ...
- ORACLE CASE WHEN 及 SELECT CASE WHEN的用法
Case具有两种格式.简单Case函数和Case搜索函数. --简单Case函数 CASE sex WHEN '1' THEN '男' WHEN '2' THEN '女' ELSE '其他' END ...
- if-else和while循环
用户登陆验证: if-else 判断 #!/usr/bin/env python # -*-coding:utf-8 -*- import getpass passwd=' name='sunhao' ...
- L266 作文
With the rapid development of modem society, an increasing number of people are concerned about the ...