AtCoder Beginner Contest竞赛题解 | AtCoder Beginner Contest 441
2026/4/27 4:15:43 网站建设 项目流程

​欢迎大家订阅我的专栏:算法题解:C++与Python实现!
本专栏旨在帮助大家从基础到进阶 ,逐步提升编程能力,助力信息学竞赛备战!

专栏特色
1.经典算法练习:根据信息学竞赛大纲,精心挑选经典算法题目,提供清晰的代码实现与详细指导,帮助您夯实算法基础。
2.系统化学习路径:按照算法类别和难度分级,从基础到进阶,循序渐进,帮助您全面提升编程能力与算法思维。

适合人群:

  • 准备参加蓝桥杯、GESP、CSP-J、CSP-S等信息学竞赛的学生
  • 希望系统学习C++/Python编程的初学者
  • 想要提升算法与编程能力的编程爱好者

附上汇总帖:AtCoder Beginner Contest竞赛题解 | 汇总


A - Black Square

【题目来源】

洛谷:[AT_abc441_a ABC441A] Black Square - 洛谷

【题目描述】

There is a grid with $ 10^{100} $ rows and $ 10^{100} $ columns.
有一个10 100 10^{100}1010010 100 10^{100}10100列网格。

In what follows, the cell at the $ i $ -th row from the top and $ j $ -th column from the left is denoted as cell $ (i,j) $ .
在下文中,从上往下第i ii行、从左往右第j jj列的单元格将记为单元格( i , j ) (i,j)(i,j)

In this grid, only the $ 100\times 100 $ region with cell $ (P,Q) $ as the top-left cell is painted black, and all other cells are painted white.
在此网格中,仅以单元格( P , Q ) (P, Q)(P,Q)为左上角的100 × 100 100\times 100100×100区域被涂为黑色,其余所有单元格均被涂为白色。

Determine whether cell $ (X,Y) $ is painted black.
判断单元格( X , Y ) (X, Y)(X,Y)是否被涂为黑色。

【输入】

The input is given from Standard Input in the following format:

$ P $ $ Q $ $ X $ $ Y $

【输出】

If cell $ (X,Y) $ is painted black, printYes; otherwise, printNo.

【输入样例】

3 3 5 10

【输出样例】

Yes

【代码详解】

#include<bits/stdc++.h>usingnamespacestd;intp,q,x,y;intmain(){// 输入cin>>p>>q>>x>>y;// 检查点(x,y)是否在矩形内if(x>=p&&x<=p+100-1&&y>=q&&y<=q+100-1)cout<<"Yes"<<endl;// 点在矩形内elsecout<<"No"<<endl;// 点在矩形外return0;}

【运行结果】

3 3 5 10 Yes

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询