比赛总结——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 ...
随机推荐
- Lua用一维数组存储一个n阶方阵,输出这个方阵的正对角线上的数的和与反对角线上的数的和的差的绝对值。
arr = {, , , , , , , , -} function diagonalDifference(arr) dimesion = math.sqrt(#arr) arr1 = {} sum1 ...
- html5-table布局
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8&qu ...
- codeforces 768c Jon Snow And His Favourite Number
题意: 给出一个数列,和一种操作,以及两个数x和k. 这个操作有两个步骤: 首先把这个数列按照升序排序,然后把所有奇数位上的数字与x异或. 问执行k次操作之后,这个数列的最大值和最小值是多少. 思路: ...
- sparkStrming 实时插入 mysql 今天使用echart 实现了简单数据展示 很low 但学习必须加深
- Hbase 过滤器的使用
Filter filter= new RowFilter(CompareFilter.CompareOp.EQUAL,new RegexStringComparator("."+d ...
- vue angular 分别实现分页
1 vue实现分页组件 paginate组件 <template> <div class="pagination-wrap" v-cloak v-if=" ...
- IntelliJ IDEA的使用之调试方法
不管学什么要及时复习和练习!!不然就会忘掉,有个输入输出的过程 IntelJ IDEA的使用之断点调试 1)添加断点:直接在代码的最左侧点一下就行,出现红色圈圈. 2)单步运行:mac中F7.F8有其 ...
- apache编译安装php后需要注意以下配置
安装后, 编辑apache配置文件 vi /usr/local/apache2/conf/httpd.conf 可以看到 LoadModule php7_module modules/libphp7. ...
- php使用phpexcel导出文件
php使用phpexcel导出文件 首先需要去官网https://github.com/PHPOffice/PHPExcel/下载PHPExcel 代码如下: <?php date_defaul ...
- oracle 12cR1&12cR2核心高实用性新特性
今天把本地环境升到了12.2.12c应该来说无论从性能和功能性方面都得到了很大的加强,就是不知道实际license怎么卖...原来有些功能在exadata中可用的,现在在12c中可用了,估计很大程度上 ...