Ural 1197 - Lonesome Knight
Input
Output
Sample
input | output |
---|---|
3 |
2 |
// Ural Problem 1197. Lonesome Knight
// Verdict: Accepted
// Submission Date: 10:31:16 14 Jan 2014
// Run Time: 0.015s
//
// 版权所有(C)acutus。(mail: acutus@126.com)
// 博客:http://www.cnblogs.com/acutus/
// [解题方法]
// 简单题,直接按题意判断即可 #include<stdio.h> int countNumber(int i, int j)
{
int count = ;
if((i - ) >= ) {
if((j - ) >= ) count++;
if((j + ) <= ) count++;
}
if((i - ) >= ) {
if((j - ) >= ) count++;
if((j + ) <= ) count++;
}
if((i + ) <= ) {
if((j - ) >= ) count++;
if((j + ) <= ) count++;
}
if((i + ) <= ) {
if((j - ) >= ) count++;
if((j + ) <= ) count++;
}
return count;
} void solve()
{
int N, n;
char c;
scanf("%d", &N);
getchar();
while(N--) {
scanf("%c%d", &c, &n);
getchar();
printf("%d\n",countNumber(c - 'a' + , n));
}
} int main()
{
solve();
return ;
}
Ural 1197 - Lonesome Knight的更多相关文章
- LeetCode 1197. Minimum Knight Moves
原题链接在这里:https://leetcode.com/problems/minimum-knight-moves/ 题目: In an infinite chess board with coor ...
- Ural 1298 Knight 题解
目录 Ural 1298 Knight 题解 题意 题解 程序 Ural 1298 Knight 题解 题意 给定一个\(n\times n(1\le n\le8)\)的国际象棋棋盘和一个骑士(基本上 ...
- 【计算几何】URAL - 2101 - Knight's Shield
Little Peter Ivanov likes to play knights. Or musketeers. Or samurai. It depends on his mood. For pa ...
- POJ2488A Knight's Journey[DFS]
A Knight's Journey Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 41936 Accepted: 14 ...
- LightOJ 1197 Help Hanzo(区间素数筛选)
E - Help Hanzo Time Limit:2000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit ...
- Knight Moves
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission( ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
- ural 2073. Log Files
2073. Log Files Time limit: 1.0 secondMemory limit: 64 MB Nikolay has decided to become the best pro ...
随机推荐
- [LeetCode]题解(python):126-Word Ladder II
题目来源: https://leetcode.com/problems/word-ladder-ii/ 题意分析: 给定一个beginWord和一个endWord,以及一个字典单词,找出所有从begi ...
- Cyclomatic complexity
Cyclomatic Code Complexity was first introduced by Thomas McCabe in 1976. In 1976, Thomas McCabe pub ...
- Dubbo原理解析-监控
Dubbo发布代码中,自带了一个简易的监控中心实现.对于一般的小业务这个监控中心应该能够满足需求,对于那些大业务量的大公司一般都会有自己的监控中心,更加丰富的功能如常用的报警短信通知等等.这章讲解分析 ...
- php 前台数据显示
<pre name="code" class="html"> public function show(){ echo "访问了index ...
- 技术不牛如何才拿到国内IT巨头的Offer
不久前,byvoid面阿里星计划的面试结果截图泄漏,引起无数IT屌丝的羡慕敬仰.看看这些牛人,NOI金牌,开源社区名人,三年级开始写Basic...在跪拜之余我们不禁要想,和这些牛人比,作为绝大部分技 ...
- 通过自定义window来实现提示框效果
#import <UIKit/UIKit.h>#import <Foundation/Foundation.h> @interface ZMStatuBarHud : NSOb ...
- 入门Html
html 超文本标记语言(Hypertext Markup Language),用于描写网页文档的标记语言,最新的版本为5.0.由万维网制定 和更新,其实它本质还是文本文件,只不过需要浏览器来解释显示 ...
- Objective-c 访问控制
在Objective-c中定义类时,也可以使用类似于C++中public.private来修饰成员变量,如下: @intterface Test:NSObject{ @public int i; in ...
- pre标签 首行会自动换行解决方案
利用pre标签可以 解决文本文档里面的空格及换行在页面上不显示的方案, 自行换行 加 white-space: pre-wrap; word-wrap: break-word; 英文字母换行 word ...
- How Many Answers Are Wrong(并查集)
Description TT and FF are ... friends. Uh... very very good friends -________-b FF is a bad boy, he ...