AtCoderBeginnerContest109题解
第一次AK,真爽qwq
A
很zz啊,,直接判断三种情况就行
/* */
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
#define Pair pair<int, int>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
#define int long long
#define LL long long
#define ull unsigned long long
#define rg register
#define pt(x) printf("%d ", x);
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 22)], *p1 = buf, *p2 = buf;
//char obuf[1<<24], *O = obuf;
//void print(int x) {if(x > 9) print(x / 10); *O++ = x % 10 + '0';}
//#define OS *O++ = ' ';
using namespace std;
//using namespace __gnu_pbds;
const int MAXN = 1e6 + , INF = 1e9 + , mod = 1e9 + ;
const double eps = 1e-;
inline int read() {
char c = getchar(); int x = , f = ;
while(c < '' || c > '') {if(c == '-') f = -; c = getchar();}
while(c >= '' && c <= '') x = x * + c - '', c = getchar();
return x * f;
}
int check(int a, int b, int c) {
return a * b * c & ;
}
main() {
int A = read(), B = read();
if(check(, A, B) || check(, A, B) || check(, A, B)) puts("Yes");
else puts("No"); return ;
}
/*
2 2 1
1 1
2 1 1
*/
A
B
直接模拟即可
/* */
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
#define Pair pair<int, int>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
#define int long long
#define LL long long
#define ull unsigned long long
#define rg register
#define pt(x) printf("%d ", x);
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 22)], *p1 = buf, *p2 = buf;
//char obuf[1<<24], *O = obuf;
//void print(int x) {if(x > 9) print(x / 10); *O++ = x % 10 + '0';}
//#define OS *O++ = ' ';
using namespace std;
//using namespace __gnu_pbds;
const int MAXN = 1e6 + , INF = 1e9 + , mod = 1e9 + ;
const double eps = 1e-;
inline int read() {
char c = getchar(); int x = , f = ;
while(c < '' || c > '') {if(c == '-') f = -; c = getchar();}
while(c >= '' && c <= '') x = x * + c - '', c = getchar();
return x * f;
}
map<string, bool> mp;
int N;
string s[MAXN];
main() {
int N = read(); for(int i = ; i <= N; i++) {
cin >> s[i];
if(mp.find(s[i]) != mp.end()) {puts("No"); return ;}
if(i > ) {
int l = s[i - ].length();
if(s[i][] != s[i - ][l - ]) {puts("No"); return ;
}
}
mp[s[i]] = ;
}
puts("Yes"); return ;
}
/*
2 2 1
1 1
2 1 1
*/
B
C
一开始想二分来着,然后发现我zz了。
直接输出 所有距离与起始距离的最大公约数即可
证明显然。。。
/* */
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
#define Pair pair<int, int>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
#define int long long
#define LL long long
#define ull unsigned long long
#define rg register
#define pt(x) printf("%d ", x);
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 22)], *p1 = buf, *p2 = buf;
//char obuf[1<<24], *O = obuf;
//void print(int x) {if(x > 9) print(x / 10); *O++ = x % 10 + '0';}
//#define OS *O++ = ' ';
using namespace std;
//using namespace __gnu_pbds;
const int MAXN = 1e6 + , INF = 1e9 + , mod = 1e9 + ;
const double eps = 1e-;
inline int read() {
char c = getchar(); int x = , f = ;
while(c < '' || c > '') {if(c == '-') f = -; c = getchar();}
while(c >= '' && c <= '') x = x * + c - '', c = getchar();
return x * f;
}
int N, a[MAXN];
main() {
int N = read(), X = read();
for(int i = ; i <= N; i++) a[i] = read();
int g = abs(X - a[]);
for(int i = ; i <= N; i++) {
int dis = abs(X - a[i]);
g = __gcd(g, dis);
}
printf("%d", g);
return ;
}
/*
2 2 1
1 1
2 1 1
*/
C
D
一开始读错题了,我以为移动几个都可以,事实上只能移动一个qwq,而且我以为0不统计入答案
我还特地问了一下,真没想到他居然知道我问的什么
考虑一个很显然的正确做法。。
先把所有奇数点往下移动,直到移动到最后一行
再把最后一行的奇数点从左往右移动。。
/* */
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<cmath>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/hash_policy.hpp>
#define Pair pair<int, int>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
//#define int long long
#define LL long long
#define ull unsigned long long
#define rg register
#define pt(x) printf("%d ", x);
//#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1<<22, stdin), p1 == p2) ? EOF : *p1++)
//char buf[(1 << 22)], *p1 = buf, *p2 = buf;
//char obuf[1<<24], *O = obuf;
//void print(int x) {if(x > 9) print(x / 10); *O++ = x % 10 + '0';}
//#define OS *O++ = ' ';
using namespace std;
//using namespace __gnu_pbds;
const int MAXN = , INF = 1e9 + , mod = 1e9 + ;
const double eps = 1e-;
inline int read() {
char c = getchar(); int x = , f = ;
while(c < '' || c > '') {if(c == '-') f = -; c = getchar();}
while(c >= '' && c <= '') x = x * + c - '', c = getchar();
return x * f;
}
int N, M;
int a[MAXN][MAXN];
int xx[] = {, -, +, , };
int yy[] = {, , , -, +};
int ans[MAXN * MAXN][], cnt = ;
void add(int i, int j, int wx, int wy) {
ans[++cnt][] = i;
ans[cnt][] = j;
ans[cnt][] = wx;
ans[cnt][] = wy;
}
main() {
N = read(); M = read();
for(int i = ; i <= N; i++)
for(int j = ; j <= M; j++)
a[i][j] = read();
for(int i = ; i < N; i++) {
for(int j = ; j <= M; j++) {
if(a[i][j] & ) {
int wx = i + , wy = j;
a[i][j]--; a[wx][wy]++;
add(i, j, wx, wy);
}
}
}
for(int i = ; i < M; i++) {
if(a[N][i] & ) {
a[N][i]--; a[N][i + ]++;
add(N, i, N, i + );
}
}
printf("%d\n", cnt);
for(int i = ; i <= cnt; i++)
printf("%d %d %d %d\n", ans[i][], ans[i][], ans[i][], ans[i][]);
return ;
}
/*
2 2 1
1 1
2 1 1
*/
D
AtCoderBeginnerContest109题解的更多相关文章
- 2016 华南师大ACM校赛 SCNUCPC 非官方题解
我要举报本次校赛出题人的消极出题!!! 官方题解请戳:http://3.scnuacm2015.sinaapp.com/?p=89(其实就是一堆代码没有题解) A. 树链剖分数据结构板题 题目大意:我 ...
- noip2016十连测题解
以下代码为了阅读方便,省去以下头文件: #include <iostream> #include <stdio.h> #include <math.h> #incl ...
- BZOJ-2561-最小生成树 题解(最小割)
2561: 最小生成树(题解) Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 1628 Solved: 786 传送门:http://www.lyd ...
- Codeforces Round #353 (Div. 2) ABCDE 题解 python
Problems # Name A Infinite Sequence standard input/output 1 s, 256 MB x3509 B Restoring P ...
- 哈尔滨理工大学ACM全国邀请赛(网络同步赛)题解
题目链接 提交连接:http://acm-software.hrbust.edu.cn/problemset.php?page=5 1470-1482 只做出来四道比较水的题目,还需要加强中等题的训练 ...
- 2016ACM青岛区域赛题解
A.Relic Discovery_hdu5982 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Jav ...
- poj1399 hoj1037 Direct Visibility 题解 (宽搜)
http://poj.org/problem?id=1399 http://acm.hit.edu.cn/hoj/problem/view?id=1037 题意: 在一个最多200*200的minec ...
- 网络流n题 题解
学会了网络流,就经常闲的没事儿刷网络流--于是乎来一发题解. 1. COGS2093 花园的守护之神 题意:给定一个带权无向图,问至少删除多少条边才能使得s-t最短路的长度变长. 用Dijkstra或 ...
- CF100965C题解..
求方程 \[ \begin{array}\\ \sum_{i=1}^n x_i & \equiv & a_1 \pmod{p} \\ \sum_{i=1}^n x_i^2 & ...
随机推荐
- ogg概叙、架构、进程
一. OGG 概述 OGG 全称Oracle Golden Gate. 历史: Golden Gate公司于1995年成立于美国加州旧金山,它的名称源自旧金山闻名于世的金门大桥.两位创始人Eric F ...
- H.264有四种画质级别
H264相关知识-poseidonqiu-ChinaUnix博客 H.264有四种画质级别分别是BP.EP.MP.HP: 1.BP-Baseline Profile:基本画质.支持I/P 帧,只支持无 ...
- 【235】Win10-Chrome 临时视频文件夹
参考:巧妙利用Chrome浏览器缓存保存网络视频参考:Win7谷歌Chrome缓存文件位置如何查看? 启动Chrome浏览器 在Chrome浏览器的地址栏输入Chrome:Version查看Chrom ...
- 使用BIND安装智能DNS服务器(一)---基本的主从DNS服务器搭建
参考网址:http://www.unixmen.com/dns-server-installation-step-by-step-using-centos-6-3/ DNS(Domain Name S ...
- POJ 1064 Cable master (二分)
题意:给定 n 条绳子,它们的长度分别为 ai,现在要从这些绳子中切出 m 条长度相同的绳子,求最长是多少. 析:其中就是一个二分的水题,但是有一个坑,那么就是最后输出不能四舍五入,只能向下取整. 代 ...
- linux 下 .o 文件, .a文件,.so文件的区别
最近在unbuntu环境下开发代码,由于很少使用linux开发环境,所以对linux编译方面了解更少,关于.o, .a, .so文件和可执行文件一直很困惑 今天特意查了一下关于它们的区分: .o 就相 ...
- POJ - 1458 Common Subsequence DP最长公共子序列(LCS)
Common Subsequence A subsequence of a given sequence is the given sequence with some elements (possi ...
- VisualStudio2017中新建的ASP.NET Core项目中的各个文件的含义
Program.cs is the entry point for the web application; everything starts from here. As we mentione ...
- JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime` from String
在使用Postman测试Spring Boot项目接口时,接口返回JSON parse error: Cannot deserialize value of type `java.time.Local ...
- 添加自定义字段至Solr 的 ExtractingRequestHandler
利用SolrJ 上传文件至Solr进行索引,比如索引一个test.pdf文件,我想在索引里添加一个文件名的字段,我在manager-schema里添加了一个字段,为“fileName”, 然后按照 g ...