zoukankan      html  css  js  c++  java
  • nyoj 1071-不可以!(a*b + fabs(a*b))

    1071-不可以!


    内存限制:64MB 时间限制:1000ms 特判: No
    通过数:10 提交数:18 难度:1

    题目描述:

    判断:两个数x、y的正负性。

    要求:不可以使用比较运算符,即"<",">","<=",">=","==","!="。

    输入描述:

    有多组数据,每组数据占一行,每一行两个数x,y。
    x、y保证在int范围内。
    

    输出描述:

    每组数据输出占一行。
    如果两个数是一正一负,输出"Signs are opposite"
    如果是同为正或同为负,输出"Signs are not opposot"
    如果无法确定,输出"Signs can't be sure"
    输出不包括引号
    

    样例输入:

    1 1
    -1 1
    

    样例输出:

    Signs are not opposot
    Signs are opposite

    C/C++:

    #include <iostream>
    #include <algorithm>
    #include <cstring>
    #include <cmath>
    #include <cstdio>
    #include <stack>
    
    using namespace std;
    
    int main() {
        int a, b;
        while (~scanf ("%d%d", &a, &b)) {
            if (a*b) { //不为零 
                if (a*b + fabs (a*b)) {
                    printf ("Signs are not opposot
    ");
                } else {
                    printf ("Signs are opposite
    ");
                }
            } else {
                printf ("Signs can't be sure
    ");
            } 
        } 
        return 0;
    }
  • 相关阅读:
    Redis
    cut
    grep
    MySQL中EXPLAIN的解释
    MySQL数据类型
    有用的MySQL语句
    mysql函数
    memcache
    存储过程 游标的使用
    存储过程批量删除
  • 原文地址:https://www.cnblogs.com/GetcharZp/p/9362317.html
Copyright © 2011-2022 走看看