小J下象棋

题目链接:https://bzoj.org/p/P00304
Description
小J正在学习下中国象棋,现在给出一个棋子的位置,小J想知道 这个棋子是否在棋盘的界内,棋盘大小为4行8列,行号标记为1到 4,列号标记为1到8。如果在界内就输出“ok”
Input
输入只有一行,包括2个整数,分别代表棋子所在的行与列
Output
如题
Samples
输入数据 1
1 2
输出数据 1
ok
Limitation
1s, 1024KiB for each test case.
Sol:很简单,只要判断行与列是否在范围内就可以了.
代码:

#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	if(n<=4 && k<=8) cout<<"ok";
	else return 0;
	return 0;
}

创作不易,点个赞再走吧!

posted @ 2024-07-05 22:46  Ace基德  阅读(38)  评论(0)    收藏  举报