比赛总结——atcoder beginner contest 109
第一次AK的ABC
虽然题非常简单
但是值得纪念一下
T1
一道很水的题
不存在做法
纯粹乱跑
但是我把Yes打成YES了,哭唧唧
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- using namespace std;
- int main(){
- int a,b;
- scanf("%d %d",&a,&b);
- if((*a*b)%==||(*a*b)%==||(*a*b)%==)
- printf("Yes\n");
- else
- printf("No\n");
- return ;
- }
T2
就是普通的判重和模拟
stl真好用
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #include <string>
- #include <set>
- #include <iostream>
- using namespace std;
- int n;
- set<string> s;
- string a;
- char lat;
- int main(){
- scanf("%d",&n);
- for(int i=;i<=n;i++){
- cin>>a;
- if(s.count(a)){
- printf("No\n");
- return ;
- }
- if(i>&&a[]!=lat){
- printf("No\n");
- return ;
- }
- lat=a[a.length()-];
- s.insert(a);
- }
- printf("Yes\n");
- return ;
- }
T3
有趣的GCD应用
秒掉
- #include <cstdio>
- #include <cstring>
- #include <algorithm>
- #define int long long
- using namespace std;
- int n,x,pos[];
- int gcd(int a,int b){
- return (b==)?a:gcd(b,a%b);
- }
- signed main(){
- scanf("%lld %lld",&n,&x);
- for(int i=;i<=n;i++)
- scanf("%lld",&pos[i]);
- for(int i=;i<=n;i++)
- pos[i]-=x;
- ++n;
- pos[n]=;
- sort(pos+,pos+n+);
- int ans=pos[]-pos[];
- for(int i=;i<=n-;i++){
- ans=gcd(ans,pos[i+]-pos[i]);
- }
- printf("%lld",ans);
- return ;
- }
T4
乍一看不好做其实很水的构造
- #include <cstdio>
- #include <algorithm>
- #include <cstring>
- #define int long long
- using namespace std;
- int mat[][],mat2[][],ans=;
- int h,w;
- signed main(){
- scanf("%lld %lld",&h,&w);
- for(int i=;i<=h;i++)
- for(int j=;j<=w;j++)
- scanf("%lld",&mat[i][j]),mat2[i][j]=mat[i][j];
- for(int i=;i<=h;i++)
- for(int j=;j<=w-;j++){
- if(mat2[i][j]%==)
- continue;
- else{
- ans++;
- mat2[i][j+]++;
- mat2[i][j]--;
- }
- //ans+=mat2[i][j],mat2[i][j+1]+=mat2[i][j],mat2[i][j]=0;
- }
- for(int i=;i<=h-;i++){
- //ans+=mat2[i][w],mat2[i+1][w]+=mat2[i][w],mat2[i][w]=0;
- if(mat2[i][w]%==)
- continue;
- else{
- ans++;
- mat2[i+][w]++;
- mat2[i][w]--;
- }
- }
- printf("%lld\n",ans);
- for(int j=;j<=h;j++)
- for(int i=;i<=w-;i++){
- if(mat[j][i]%==)
- continue;
- else{
- printf("%lld %lld %lld %lld\n",j,i,j,i+);
- mat[j][i+]++;
- mat[j][i]--;
- }
- // for(int k=1;k<=mat[j][i];k++){
- // printf("%d %d %d %d\n",j,i,j,i+1);
- // mat[j][i+1]+=1;
- // }
- // mat[j][i]=0;
- }
- for(int i=;i<=h-;i++){
- if(mat[i][w]%==)
- continue;
- else{
- mat[i+][w]++;
- mat[i][w]--;
- printf("%lld %lld %lld %lld\n",i,w,i+,w);
- }
- }
- // for(int k=1;k<=mat[i][w];k++)
- // printf("%d %d %d %d\n",i,w,i+1,w),mat[i+1][w]++;
- return ;
- }
比赛总结——atcoder beginner contest 109的更多相关文章
- 2018.09.08 AtCoder Beginner Contest 109简要题解
比赛传送门 水题大赛? 全是水题啊!!! T1 ABC333 就是判断是不是两个数都是奇数就行了. 代码: #include<bits/stdc++.h> using namespace ...
- AtCoder Beginner Contest 053 ABCD题
A - ABC/ARC Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Smeke has ...
- AtCoder Beginner Contest 154 题解
人生第一场 AtCoder,纪念一下 话说年后的 AtCoder 比赛怎么这么少啊(大雾 AtCoder Beginner Contest 154 题解 A - Remaining Balls We ...
- AtCoder Beginner Contest 161
比赛链接:https://atcoder.jp/contests/abc161/tasks AtCoder Beginner Contest 161 第一次打AtCoder的比赛,因为是日本的网站终于 ...
- AtCoder Beginner Contest 224
AtCoder Beginner Contest 224 A - Tires 思路分析: 判断最后一个字符即可. 代码如下: #include <bits/stdc++.h> using ...
- AtCoder Beginner Contest 184 题解
AtCoder Beginner Contest 184 题解 目录 AtCoder Beginner Contest 184 题解 A - Determinant B - Quizzes C - S ...
- AtCoder Beginner Contest 169 题解
AtCoder Beginner Contest 169 题解 这场比赛比较简单,证明我没有咕咕咕的时候到了! A - Multiplication 1 没什么好说的,直接读入两个数输出乘积就好了. ...
- AtCoder Beginner Contest 148 题解
目录 AtCoder Beginner Contest 148 题解 前言 A - Round One 题意 做法 程序 B - Strings with the Same Length 题意 做法 ...
- AtCoder Beginner Contest 100 2018/06/16
A - Happy Birthday! Time limit : 2sec / Memory limit : 1000MB Score: 100 points Problem Statement E8 ...
随机推荐
- hdu1757 构造矩阵
Lele now is thinking about a simple function f(x). If x < 10 f(x) = x.If x >= 10 f(x) = a0 * f ...
- Solid Dominoes Tilings (轮廓线dp打表 + 容器)
第一步先打一个表,就是利用轮廓线DP去打一个没有管有没有分界线组合数量的表 #include<bits/stdc++.h> using namespace std; ; <<; ...
- uva 11183 Teen Girl Squad
题意: 有一个女孩,需要打电话让所有的人知道一个消息,消息可以被每一个知道消息的人传递. 打电话的关系是单向的,每一次电话需要一定的花费. 求出打电话最少的花费或者判断不可能让所有人知道消息. 思路: ...
- mybatis源码解析4---Configuration解析
Configuration类解析 Configuration类位于mybatis包的org.apache.ibatis.session目录下,是mybatis的全局变量,属性就是对应于mybatis的 ...
- Flask的请求对象--request
request-Flask的请求对象 请求解析和响应封装大部分是有Werkzeug完成的,Flask子类化Werkzeug的请求(Request)对象和响应(Response)对象,并添加了和程序的特 ...
- 禁用HTTP.sys,导致80端口被禁用和IIS服务无法启动解决办法
由于端口被占用,使用 win+r 运行 cmd 输入netstat -ano 可以看到端口被PIF 4占用,可以找到对应的进程NT kernel& System 该进程是Http.sys,是h ...
- WebStorm: The Smartest JavaScript IDE by JetBrains
WebStorm: The Smartest JavaScript IDE by JetBrains https://www.jetbrains.com/webstorm/?fromMenu
- scss简单用法
- MySQL性能测试工具sysbench的安装和使用
sysbench是一个开源的.模块化的.跨平台的多线程性能测试工具,可以用来进行CPU.内存.磁盘I/O.线程.数据库的性能测试.目前支持的数据库有MySQL.Oracle和PostgreSQL.当前 ...
- 通过数组和枚举简化GPIO操作编码(转)
源: 通过数组和枚举简化GPIO操作编码