比赛总结——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 ...
随机推荐
- Code Review(转)
Code Review是一种通过复查代码提高代码质量的过程,在XP方法中占有极为重要的地位,也已经成为软件工程中一个不可缺少的环节.本文通过对Code Review的一些概念和经验的探讨,就如何进行C ...
- [转]sql server 常用脚本(日常查询所需)
1:查看sql server代理中作业的运行状况的脚本 -- descr : a simple sql script to view sql server jobs run status -- las ...
- EF使用sql语句
https://www.cnblogs.com/chenwolong/p/SqlQuery.html https://blog.csdn.net/zdhlwt2008/article/details/ ...
- Talented Chef ZOJ - 3778
As we all know, Coach Gao is a talented chef, because he is able to cook M dishes in the same time. ...
- camera理论基础和工作原理(转)
源: camera理论基础和工作原理
- Web开发笔记 #06# 前后端分离
前后端分离 关于“前后端分离”的深入讨论: 如何正确理解前后端分离? Web 前后端分离的意义大吗? 在上面有看到有谈“国外it公司分工”的回答,感觉挺有意思的.大概是讲国外it公司并不分前后端,只分 ...
- Google's Machine Learning Crash Course #04# First Steps with TensorFlow
1.使用 TensorFlow 的建议 Which API(s) should you use? You should use the highest level of abstraction tha ...
- 软件工程 #02# Entity Relationship Diagram VS. 用 UML 中的类图表示 E-R 图
不同的老师叫我们画 E-R 图居然是不一样的,于是我仔细研究了一番.. 通常所说的 E-R 图(外文全称 Entity Relationship Diagram,简称 ERD)长这个样子: 而有时候它 ...
- php+js 防止被抓包篡改数据,数据签名校验
签名密钥,这个是自己生成的,需要客户端+服务端一致. <?php /** * 获取签名 * @param $data 提交的数据 * @param $key 安全密钥 * @return boo ...
- php 获取文件后缀
/** * 获取文件后缀 * $path 本地存储临时文件路径 * */ private function getFileType($path){ $fp=fopen($path,'r'); $bin ...