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 ...
随机推荐
- linux所有信息查询网址
- 转: vim简明教程
vim的学习曲线相当的大(参看各种文本编辑器的学习曲线),所以,如果你一开始看到的是一大堆VIM的命令分类,你一定会对这个编辑器失去兴趣的.下面的文章翻译自<Learn Vim Progress ...
- WEB和APP谁是互联网未来
据中国多家权威报告显示,作为多年专业化互联网公司炎帝网络科技综合评估预测,预计2016年全球互联网设备将达到100亿部.如果届时全球人口达到73亿,意味着平均每人将有1.4部设备.智能交通将增长50倍 ...
- [Windows编程] #pragma once 和#ifndef ... #define ... #endif 比较
C++中防止头文件被多次include 的常见方式有: 1) 用#ifndef ... #define ... #endif 宏 #ifndef __MYHEADER_H__#define __M ...
- SpringMVC静态文件(图片)访问+js访问 简单小例子
项目文件布局: web.xml文件: <?xml version="1.0" encoding="UTF-8"?> <web-app vers ...
- linux内核源码阅读之facebook硬盘加速利器flashcache
从来没有写过源码阅读,这种感觉越来越强烈,虽然劣于文笔,但还是下定决心认真写一回. 源代码下载请参见上一篇flashcache之我见 http://blog.csdn.net/liumangxiong ...
- 讲讲金融业务(一)--自助结算终端POS
之前在群里和大家聊天的时候,发现好多人对银行业务比較感兴趣,或许是由于大家对银行不了解,以为非常神奇的样子.全部,从这周開始我打算把我肚子里的墨水慢慢地倒出来,和大家分享分享. 在技术还不发达的时 ...
- SVNserver的本地搭建和使用
Subversion是优秀的版本号控制工具,其具体的的长处和具体介绍,这里就不再多说. 首先来下载和搭建SVNserver. 如今Subversion已经迁移到apache站点上了,下载地址: htt ...
- Sql语句之select 5种查询
select 5种子句:注意顺序where / group by /having / order by / limit / 清空表中的数据:truncate 表名: 导入表结构(不含数据): crea ...
- Stack集合、queue集合、hashtable集合
1.栈:Stack,先进后出,一个一个赋值,一个一个取值,按顺序. .count 取集合内元素的个数 .push() 将元素一个一个推入集合中//stack集合存入 ...