首页 > ACM题库 > HDU-杭电 > hdu 2101 A + B Problem Too[解题报告]C++
2013
12-29

hdu 2101 A + B Problem Too[解题报告]C++

A + B Problem Too

问题描述 :

This problem is also a A + B problem,but it has a little difference,you should determine does (a+b) could be divided with 86.For example ,if (A+B)=98,you should output no for result.

输入:

Each line will contain two integers A and B. Process to end of file.

输出:

Each line will contain two integers A and B. Process to end of file.

样例输入:

1 1
8600 8600

样例输出:

no
yes

2011-12-15 02:06:24

地址:http://acm.hdu.edu.cn/showproblem.php?pid=2101

题意:两数和是否是86的倍数。

代码:

# include <stdio.h>


int main ()
{
    int a, b ;
    while (~scanf ("%d%d", &a, &b))
        puts (((a+b)%86) ? "no" : "yes") ;
    return 0 ;
}

解题转自:http://www.cnblogs.com/lzsz1212/archive/2012/01/06/2314616.html


  1. 感觉你缺乏对以前社会的认识,也缺乏对中国自己的认识……这个没啥必要继续说了,世界上早有公论,你发明个新观点也无所谓,不影响什么的。

  2. 算法是程序的灵魂,算法分简单和复杂,如果不搞大数据类,程序员了解一下简单点的算法也是可以的,但是会算法的一定要会编程才行,程序员不一定要会算法,利于自己项目需要的可以简单了解。

  3. int half(int *array,int len,int key)
    {
    int l=0,r=len;
    while(l<r)
    {
    int m=(l+r)>>1;
    if(key>array )l=m+1;
    else if(key<array )r=m;
    else return m;
    }
    return -1;
    }
    这种就能避免一些Bug
    l,m,r
    左边是l,m;右边就是m+1,r;