一道简单的规律题,画出二维表将数字分别相加可以发现很明显的对称性

题目链接:http://www.bnuoj.com/v3/problem_show.php?pid=24251

 #include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std; int main()
{
int sum,n,m,Num,i,t;
scanf("%d",&sum);
for(i=;i<=sum;i++)
{
scanf("%d %d",&n,&m);
if(n>m)
{
int x=n;
n=m;
m=x;
}
scanf("%d",&t);
printf("Case #%d:\n",i);
while(t--)
{
scanf("%d",&Num);
if(Num>n+m)
printf("0\n");
else if(Num>n && Num>m)
printf("%d\n",n+m-Num+);
else if(Num<=n && Num<=m)
{
if(Num == )
printf("0\n");
else
printf("%d\n",Num-);
}
else if(Num>n && Num<=m)
{
printf("%d\n",n);
}
else if(Num==n && Num<=m)
{
printf("%d\n",n-);
} } }
return ;
}

bnuoj 24251 Counting Pair的更多相关文章

  1. Counting Pair

    Counting Pair Time Limit: 1000 ms Memory Limit: 65535 kB Solved: 112 Tried: 1209 Submit Status Best ...

  2. Sichuan State Programming Contest 2012 C。Counting Pair

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=118254#problem/C 其实这道题目不难...就是没有仔细分析... 我们可以发现 ...

  3. HDU 4358 Boring counting(莫队+DFS序+离散化)

    Boring counting Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 98304/98304 K (Java/Others) ...

  4. HDU 1264 Counting Squares(线段树求面积的并)

    Counting Squares Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  5. SDUT 2610 Boring Counting(离散化+主席树区间内的区间求和)

    Boring Counting Time Limit: 3000MS Memory Limit: 65536KB Submit Statistic Discuss Problem Descriptio ...

  6. HDU 5952 Counting Cliques 【DFS+剪枝】 (2016ACM/ICPC亚洲区沈阳站)

    Counting Cliques Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  7. BZOJ2023: [Usaco2005 Nov]Ant Counting 数蚂蚁

    2023: [Usaco2005 Nov]Ant Counting 数蚂蚁 Time Limit: 4 Sec  Memory Limit: 64 MBSubmit: 56  Solved: 16[S ...

  8. Counting Islands II

    Counting Islands II 描述 Country H is going to carry out a huge artificial islands project. The projec ...

  9. Counting Intersections

    Counting Intersections Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/ ...

随机推荐

  1. Android手机的上网功能需要用到APN(网络接入点)的设置 电信

    手机apn出问题了,上不网 电信天翼: 我们经常使用的APN有三个,分别是NET网络设置.WAP网络设置和彩信网络设置. 1.NET网络设置 名称:CTNET APN:#777 用户名:ctnet@m ...

  2. 淘宝(阿里百川)手机客户端开发日记第十二篇 mysql的认识

    我这里用的是wamp,大家可以到网上去下载对应的包,自行安装,对于程序员来讲,安装软件大部分都应该不是问题的,所以我不去将具体安装的方法. wamp安装好后,在我们屏幕的右下角, 这样的图标,我们右键 ...

  3. HDU 3743 Frosh Week(归并排序求逆序对)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3743 题目意思就是给你一个长为n的序列,让你求逆序对.我用的是归并排序来求的.归并排序有一个合并的过程 ...

  4. iOS开发——高级篇——iOS 中的 NSTimer

    以前的老代码在使用 NSTimer 时出现了内存泄露 NSTimer fire 我们先用 NSTimer 来做个简单的计时器,每隔5秒钟在控制台输出 Fire .比较想当然的做法是这样的: 1 2 3 ...

  5. BZOJ1503——郁闷的出纳员

    1.题目大意:一道treap题,支持插入,询问第K大,还有全体修改+上一个值,如果某个点值小于x,那么就删除这个点 插入100000次,询问100000次,修改100次..最后输出删了多少个点 2.分 ...

  6. iOS软件版本更新思路

    iOS软件更新思路 需要更新版本数组 needUpdateVersions{1.2.61.2.8} 历史版本数组 historyUpdateVersions1.2.41.2.51.2.6 更新数据库1 ...

  7. 《C和指针(Pointer on c)》 学习笔记(转自:http://dsqiu.iteye.com/blog/1687944)

    首先本文是对参考中三个连接的博客进行的整理,非常感谢三位博主的努力,每次都感叹网友的力量实在太强大了…… 第一章 快速上手 1.  在C语言中用/*和*/来注释掉这段代码,这个实际上并不是十分的安全, ...

  8. Github如何更新远程代码

    1.git add . 2.git commit -m "Second commit" 3.git push origin master

  9. hibernate query.list() 返回的数据类型

    在hibernate中,用hql语句查询实体类,采用list方法的返回结果为一个List,该List中封装的对象分为以下三种情况: 1.查询全部字段的情况下,如"from 实体类" ...

  10. c语言——知识点

    环境: ubuntu 13.04 32位 gcc version 4.7.3 ++i,i++ 代码如下: #include <stdio.h> main() { int i; //test ...