cometoj(A-D+F+H)代码
A
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<cmath> const int maxn=1e5+;
typedef long long ll;
using namespace std; int main()
{
ll n;
scanf("%lld",&n);
ll ss=(+n)*n/;
ss+=(n)*(n-)/;
printf("%lld",ss);
return ;
}
B
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<cmath> const int maxn=1e5+;
typedef long long ll;
using namespace std;
int a[];
int vis[];
int main()
{
int T;
cin>>T;
int n;
while(T--)
{
scanf("%d",&n);
for(int t=;t<n;t++)
{
scanf("%d",&a[t]);
}
int maxx=;
for(int t=;t<<<n;t++)
{
memset(vis,,sizeof(vis));
for(int j=;j<n;j++)
{
vis[n--j]=t>>j&;
}
int sum=;
for(int j=;j<n;j++)
{
if(vis[j]==)
{
sum++;
}
}
bool flag=false;
for(int j=;j<n;j++)
{
for(int k=j+;k<n;k++)
{
if(vis[j]==&&vis[k]==)
{
if(__gcd(a[j],a[k])!=)
{
flag=true;
}
}
}
}
if(flag==false)
{
maxx=max(maxx,sum);
} }
printf("%d\n",maxx);
} return ;
}
C
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<cmath>
const int maxn=1e5+;
typedef long long ll;
using namespace std; char str1[*maxn],str2[*maxn]; int main()
{
int T;
cin>>T;
while(T--)
{
scanf("%s%s",str1,str2);
int len1=strlen(str1);
int len2=strlen(str2);
if(len1==len2+)
{
int cnt=;
for(int t=;t<len1;t++)
{
if(str2[cnt]==str1[t])
{
cnt++;
}
}
if(cnt==len2)
{
printf("1\n");
}
else
{
printf("0\n");
}
}
else
{
printf("0\n");
}
}
return ;
}
D:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<cmath>
const int maxn=1e5+5;
typedef long long ll;
using namespace std;
int a[20]; int vis[25]; int main() { int x; for(int t=0;t<18;t++) { scanf("%d",&x); vis[x]++; } for(int t=1;t<14;t++) { if(vis[t]%2==0) { vis[t]=0; } else { vis[t]=1; } } int ans=0; for(int t=0;t<14;t++) { ans+=vis[t]; } cout<<ans<<endl; return 0; }
F:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<cmath>
const int maxn=1e5+;
typedef long long ll;
using namespace std;
int vis[][];
int dir[][]={{-,},{-,-},{,-},{,-},{,},{,},{,},{-,},{-,}};
int n,m;
bool check(int x,int y)
{
if(x>=&&x<=n&&y>=&&y<=m)
{
return true;
}
else
{
return false;
}
}
int main()
{
int q;
cin>>n>>m>>q;
int ans=(n-)*(m-);
int x,y;
while(q--)
{
scanf("%d%d",&x,&y);
vis[x][y]=;
int cnt=;
for(int t=;t<;t++)
{
int xx=x+dir[t][];
int yy=y+dir[t][];
if(check(xx,yy)&&vis[xx][yy]==)
{
cnt++;
} }
if(cnt==)
{ ans--;
}
cnt=;
for(int t=;t<;t++)
{
int xx=x+dir[t][];
int yy=y+dir[t][];
if(check(xx,yy)&&vis[xx][yy]==)
{
cnt++;
} }
if(cnt==)
{ ans--;
}
cnt=;
for(int t=;t<;t++)
{
int xx=x+dir[t][];
int yy=y+dir[t][];
if(check(xx,yy)&&vis[xx][yy]==)
{
cnt++;
} }
if(cnt==)
{ ans--;
}
cnt=;
for(int t=;t<;t++)
{
int xx=x+dir[t][];
int yy=y+dir[t][];
if(check(xx,yy)&&vis[xx][yy]==)
{
cnt++;
} }
if(cnt==)
{ ans--;
}
printf("%d\n",ans); }
return ;
}
H:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<vector>
#include<map>
#include<cmath> const int maxn=1e5+;
typedef long long ll;
using namespace std;
int a[*maxn];
int main()
{
int n;
cin>>n;
for(int t=;t<n;t++)
{
scanf("%d",&a[t]);
}
bool down=true;
int h=0x3f3f3f3f;
int ans=;
for(int t=;t<n;t++)
{
if(down)
{
if(a[t]>=h)
{
down=false;
ans++;
}
}
else
{
if(a[t]<=h)
{
down=true;
} }
h=a[t];
}
cout<<ans<<endl; return ;
}
cometoj(A-D+F+H)代码的更多相关文章
- 《linux 内核全然剖析》sched.c sched.h 代码分析笔记
版权声明:本文为博主原创文章.未经博主同意不得转载. https://blog.csdn.net/u011368821/article/details/25129835 sched.c sched.h ...
- Good Bye 2018 (A~F, H)
目录 Codeforces 1091 A.New Year and the Christmas Ornament B.New Year and the Treasure Geolocation C.N ...
- 2016CCPC长春 - B/D/F/H/I/J/K - (待补)
目录: B - Fraction D - Triangle F - Harmonic Value Description H - Sequence I I - Sequence II B题:HDU 5 ...
- 2019牛客暑期多校训练营(第七场)E F H I
E Find the median 题意:每次往序列中增加连续的[l,r]的数,每加入一次就询问当前序列的中位数. 解法:此题没有要求在线,那么直接离线+线段树+二分就可以了.求出每个端点之后排序得到 ...
- unix编程书中的 ourhdr.h代码
真心不知到里面写的具体什么意思,先记下吧. /*Our own header, to be included after all standard system headers*/ #ifndef _ ...
- The 13th Chinese Northeast Collegiate Programming Contest(B C E F H J)
B. Balanced Diet 思路:把每一块选C个产生的价值记录下来,然后从小到大枚举C. #include<bits/stdc++.h> using namespace std; ; ...
- eclipse使用ctrl+shift+F格式化代码失效
通常情况出现这种问题是组合快捷键和别的软件快捷键冲突了, 最常见的是和搜狗输入法冲突, 在设置中找到搜狗输入法然后把冲突的快捷键取消掉就可以了.
- MyEclipse中Ctrl+Shift+F快捷键格式化代码时不换行
摘自: http://iteye.blog.163.com/blog/static/18630809620121166622410/ MyEclipse中Ctrl+Shift+F快捷键格式化代码时不换 ...
- RapidJSON 代码剖析(四):优化 Grisu
我曾经在知乎的一个答案里谈及到 V8 引擎里实现了 Grisu 算法,我先引用该文的内容简单介绍 Grisu.然后,再谈及 RapidJSON 对它做了的几个底层优化. (配图中的<Grisù& ...
随机推荐
- 文件权限和访问控制列表ACL (1)
背景知识: 文件的权限主要针对三类对象进行定义 Owner: 属主u Group: 属组g Other: 其他o 每个文件针对每一类的访问者都设定了三种权限 r: Readable 读 w: Writ ...
- python2.2 elif多条件判断
#案例:存款大于100万,买宝马:大于50万买丰田:大于20万买二手车:小于20万自行车! cunkuan=60#elif多条件判断,else:不满足elif执行其他命令if cunkuan>1 ...
- 020_go语言中的接口
代码演示 package main import ( "fmt" "math" ) type geometry interface { area() float ...
- ebook 电子书项目
ebook电子书网站使用eclipse开发,开发语言主体是JAVA,使用的是servlet+jsp,前端使用javascript和jQuery,页面布局设计使用的是bootstrap,在这里我记下我开 ...
- git使用-标签管理
1.查看所有的标签 git tag 2.创建标签 git tag name 3.指定提交标签的信息 git tag -a name -m "comment" 4.删除标签 git ...
- OGG复制进程延迟高,优化方法一(使用索引)
日常运维过程中,可能发现OGG同步进程延迟很高: 本篇介绍其中的一种方式. OGG复制进程,或者说同步进程及通过解析ogg trail文件,输出dml语句,在目标库执行dml操作,那么延迟高可能性其一 ...
- java final关键字与static关键字
一 final关键字 1.final修饰类不可以被继承,但是可以继承其他类. 例如: class Yy {} final class Fu extends Yy{} //可以继承Yy类 class ...
- 痞子衡嵌入式:一种i.MXRT下从App中进入ROM串行下载模式的方法
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是i.MXRT下在App中利用ROM API进ISP/SDP模式的方法. 我们知道i.MXRT系列分为两大阵营:CM33内核的i.MXRT ...
- tableau用户留存分析
1.数据源 这是个母婴产品的购买流水数据 2.数据处理 字段拆分.创建购买点会员生命周期 3.分析不同省份的留存率情况 根据第12个月的留存率对省市进行分组 实际业务中也可以通过类似的方法对用户年龄组 ...
- 2020-04-29:现在你有个秒杀抢购的app,用户不断大量增加,技术层面,你要怎么做
2020-04-29:现在你有个秒杀抢购的app,用户不断大量增加,技术层面,你要怎么做,才能既满足用户需求,又能扛住压力,还能帮公司合理支出?福哥答案2020-04-29: 限流(杀部分用户祭天). ...