• poj1555


    简单题

    View Code
    #include <iostream>
    #include
    <cstdio>
    #include
    <cstdlib>
    #include
    <cstring>
    using namespace std;

    #define maxn 10

    int f[maxn];

    void input()
    {
    for (int i = 1; i < 9; i++)
    scanf(
    "%d", &f[i]);
    }

    void print()
    {
    char ch[2];
    ch[
    0] = '+';
    ch[
    1] = '-';
    int i = 0;
    while (i < 9 && f[i] == 0)
    i
    ++;
    if (i >= 9)
    {
    printf(
    "0\n");
    return;
    }
    if (i == 8)
    {
    printf(
    "%d\n", f[8]);
    return;
    }
    if (f[i] < 0)
    putchar(
    '-');
    if (abs(f[i]) > 1)
    printf(
    "%d", abs(f[i]));
    putchar(
    'x');
    if (8 - i > 1)
    printf(
    "^%d", 8 - i);
    i
    ++;
    for (; i < 8; i++)
    if (f[i])
    {
    printf(
    " %c ", ch[f[i] < 0]);
    if (abs(f[i]) > 1)
    printf(
    "%d", abs(f[i]));
    putchar(
    'x');
    if (8 - i > 1)
    printf(
    "^%d", 8 - i);
    }
    if (f[i] != 0)
    printf(
    " %c %d", ch[f[i] < 0], abs(f[i]));
    putchar(
    '\n');
    }

    int main()
    {
    //freopen("t.txt", "r", stdin);
    while (scanf("%d", &f[0]) != EOF)
    {
    input();
    print();
    }
    return 0;
    }
  • 相关阅读:
    常见的灰度发布系统规则
    golang中的路由分组
    艾森豪威尔矩阵
    列文定理
    吃狗粮定理
    mysql事务 锁
    mysql中explain优化分析
    mysql hash索引优化
    各种浏览器内核介绍
    浏览器 兼容性问题总结
  • 原文地址:https://www.cnblogs.com/rainydays/p/2116112.html
Copyright © 2020-2023  润新知