比赛总结——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 ...
随机推荐
- JDBC操作数据库步骤
2018-11-04 20:23:24开始写 1.加载驱动程序(Class.forName) 2.建立连接获取数据库连接对象(DriverManager.getConnection) 3.向数据库发 ...
- 排序(Sort)-----插入排序
声明:文中动画转载自https://blog.csdn.net/qq_34374664/article/details/79545940 1.插入排序简介 插入排序(InsertSort) ...
- 输出列表为字符串,并在最后一个值前加上and 4.10.1
逗号代码: def test4(lis): str1='' for i in range(len(lis)-1): str1+=(str(val[i])+', ') str1+=('and '+str ...
- mybatis源码解析1--前言
在开始分析mybatis源码之前,需要定一个目标,也就是我们不是为了读源码而去读,一定是带着问题去读,在读的时候去寻找到答案,然后再读码的同时整理总结,学习一些高级的编码方式和技巧. 首先我们知道my ...
- Linux基础命令---添加用户useradd
useradd 创建新的系统用户,useradd指令只能以管理员的身份运行,创建的用户都在“/etc/passwd”文件中.当不加-D参数,useradd指令使用命令列来指定新帐号的设定值and使用系 ...
- 那个写书教你交易期权的人James Cordier爆仓了
那个写书教你交易期权的人James Cordier爆仓了 11月15日,James Cordier掌管的期权交易公司OptionSellers.com通过邮件告知投资者,其公司管理的账户遭遇了毁灭性的 ...
- 网上搜到的权限系统demo
网上搜到的权限系统demo http://www.sojson.com/shiro
- Python2的一些问题及解决办法
1. 无法注释中文的解决办法 # -*- coding:utf8 -*- # 添加这一行就行了 from django.contrib import admin from myapp.models i ...
- P4577 [FJOI2018]领导集团问题
P4577 [FJOI2018]领导集团问题 我们对整棵树进行dfs遍历,并用一个multiset维护对于每个点,它的子树可取的最大点集. 我们遍历到点$u$时: 不选点$u$,显然答案就为它的所有子 ...
- P2044 [NOI2012]随机数生成器
洛咕原题 正常的矩乘题. 但是,计算过程中会爆long long. 所以,我们要用快速(龟速)乘来解决. 快速乘,也就是把快速幂稍作修改.乘法被分成若干个加法,以时间为代价解决精度问题. #inclu ...