比赛传送门

水题大赛?

全是水题啊!!!


T1

ABC333

就是判断是不是两个数都是奇数就行了。

代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin>>a>>b;
    if(a%2&&b%2)cout<<"Yes";
    else cout<<"No";
    return 0;
}

T2

Shiritori

sb字符串模拟(打比赛读题失误233)

代码:

#include<bits/stdc++.h>
using namespace std;
int n;
string w[105];
bool vis[26];
map<string,int>s;
int main(){
    cin>>n;
    bool f=true;
    for(int i=1;i<=n;++i){
        cin>>w[i];
        if(s[w[i]])f=false;
        s[w[i]]=1;
    }
    for(int i=2;i<=n;++i){
        if(w[i-1][w[i-1].size()-1]==w[i][0])continue;
        f=false;
    }
    if(f)cout<<"Yes";
    else cout<<"No";
    return 0;
}

T3

Skip

就是求一堆数的最大公约数。

直接把X放进x数组里一起排序后求所有连续两个数的差值的最大公约数就行了。

代码;

#include<bits/stdc++.h>
#define N 100005
using namespace std;
inline int read(){
    int ans=0;
    char ch=getchar();
    while(!isdigit(ch))ch=getchar();
    while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
    return ans;
}
int n,x[N];
inline int gcd(int a,int b){while(b){int t=a;a=b,b=t%a;}return a;}
int main(){
    n=read()+1;
    for(int i=1;i<=n;++i)x[i]=read();
    sort(x+1,x+n+1);
    int g=x[2]-x[1];
    for(int i=3;i<=n;++i)g=gcd(g,x[i]-x[i-1]);
    cout<<g;
    return 0;
}

T4

Make Them Even

这题直接贪心就完了啊。

对于每一行,我们从左到右判断。

如果当前格子中是奇数,那么向右移,判断下一个格子;否则直接判断下一个格子。

注意:我们并不判断最后一列。

所有行操作完之后除最后一列之外全是偶数了。

于是最后一列从上到下判断。

如果当前格子中是奇数,那么向下移,判断下一个格子;否则直接判断下一个格子。

统计完后输出方案就行了。

代码:

#include<bits/stdc++.h>
#define N 505
using namespace std;
inline int read(){
    int ans=0;
    char ch=getchar();
    while(!isdigit(ch))ch=getchar();
    while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch^48),ch=getchar();
    return ans;
}
int h,w,a[N][N],pos[N];
bool vis[N][N],is[N][N];
struct Node{int a,b,c,d;};
vector<Node>q;
int main(){
    h=read(),w=read();
    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j)a[i][j]=read();
        for(int j=1;j<w;++j)if(a[i][j]&1)a[i][j+1]++,q.push_back((Node){i,j,i,j+1});
    }
    for(int i=1;i<h;++i)if(a[i][w]&1)a[i+1][w]++,q.push_back((Node){i,w,i+1,w});
    cout<<q.size()<<'\n';
    for(int i=0;i<q.size();++i)cout<<q[i].a<<' '<<q[i].b<<' '<<q[i].c<<' '<<q[i].d<<'\n';
    return 0;
}

ak之后意外得知这场rating1200+就不计unrated了excuse me?

2018.09.08 AtCoder Beginner Contest 109简要题解的更多相关文章

  1. 2018.09.02 Atcoder Regular Contest 102简要题解

    比赛传送门 T1 Triangular Relationship 分析之后发现有两种情况: 1. n为奇数,那么所有数都是k的倍数. 2. n为偶数,那么所有数都是k/2的倍数. 然后就可以愉快A题了 ...

  2. Atcoder Beginner Contest 138 简要题解

    D - Ki 题意:给一棵有根树,节点1为根,有$Q$次操作,每次操作将一个节点及其子树的所有节点的权值加上一个值,问最后每个节点的权值. 思路:dfs序再差分一下就行了. #include < ...

  3. KYOCERA Programming Contest 2021(AtCoder Beginner Contest 200) 题解

    KYOCERA Programming Contest 2021(AtCoder Beginner Contest 200) 题解 哦淦我已经菜到被ABC吊打了. A - Century 首先把当前年 ...

  4. AtCoder Grand Contest 031 简要题解

    AtCoder Grand Contest 031 Atcoder A - Colorful Subsequence description 求\(s\)中本质不同子序列的个数模\(10^9+7\). ...

  5. 比赛总结——atcoder beginner contest 109

    第一次AK的ABC 虽然题非常简单 但是值得纪念一下 T1 一道很水的题 不存在做法 纯粹乱跑 但是我把Yes打成YES了,哭唧唧 #include <cstdio> #include & ...

  6. AtCoder Beginner Contest 089完整题解

    A - Grouping 2 Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement There a ...

  7. AtCoder Grand Contest 040 简要题解

    从这里开始 比赛目录 A < B < E < D < C = F,心情简单.jpg. Problem A >< 把峰谷都设成 0. Code #include &l ...

  8. AtCoder Grand Contest 035 简要题解

    从这里开始 题目目录 Problem A XOR Circle 你发现,权值的循环节为 $a_0, a_1, a_0\oplus a_1$,然后暴力即可. Code #include <bits ...

  9. AtCoder Grand Contest 036 简要题解

    从这里开始 比赛目录 Problem A Triangle 考虑把三角形移到和坐标轴相交,即 然后能够用坐标比较简单地计算面积,简单构造一下就行了. Code #include <bits/st ...

随机推荐

  1. springboot的全局异常通知

    ExceptionHandler:拦截所有通知

  2. const对象,指向const对象的指针 和 const 指针

    const对象: const对象声明时必须赋初值,该值在编译阶段确定,不可在程序中修改. const修饰符既可放在类型名前也可放在类型名后,通常放在类型名前.不过放在类型名后易于理解. const i ...

  3. Ibatis/Mybatis模糊查询

    Ibatis/Mybatis模糊查询 根据网络内容整理 Ibatis中 使用$代替#.此种方法就是去掉了类型检查,使用字符串连接,不过可能会有sql注入风险. Sql代码 select * from ...

  4. How to Pronounce the I in ING

    How to Pronounce the I in ING Share Tweet Share Tagged With: ING Verbs The I in ING is the IH as in ...

  5. 精确除法:from __future__ import division

    在python中做除法运算,使用1/2运行结果为0,为取结果的整数部分 如果用1.0/2或1/2.0运行结果为0.5,按照浮点数的位数取结果 但是实际应用中我们需要取除法的精确结果,我们就可以在运行前 ...

  6. JSP页面与JSP页面之间传输参数出现中文乱码的解决方案

    在学习编程初期JSP与JSP页面之间传输参数大多数都是使用这样的方式 index.jsp?id=*&name=* 这样的传输方式实质上是一种GET传输方式, 那如果出现了中文乱码, 解决方法其 ...

  7. racktables 的介绍及搭建指南

    Racktables RackTables称自己为一个“机架空间.IP地址.服务器.交换机.路由器等 的管理框架”.它拥有一个web界面,执行报告和配置,并管理名字服务.RackTables以PHP5 ...

  8. label文字从左上角开始

    import UIKit class TextUpperLeftLabel: UILabel { override func textRect(forBounds bounds: CGRect, li ...

  9. js Array Map and Set

    Array slice slice()就是对应String的substring()版本,它截取Array的部分元素,然后返回一个新的Array: var arr = ['A', 'B', 'C', ' ...

  10. Spring框架管理开源的连接池

    1. 管理DBCP连接池 * 先引入DBCP的2个jar包 * com.springsource.org.apache.commons.dbcp-1.2.2.osgi.jar * com.spring ...