zoukankan      html  css  js  c++  java
  • poj2871

    #include <stdio.h>
    #include <stdlib.h>
    //法一
    int main()
    {
        double temar[10000];
        int i=0,tmp;
        while(1)
        {
            scanf("%lf",&temar[i]);
            if(temar[i] == 999)
                break;
            i++;
        }
        tmp=i-1;
        for(i=1; i<=tmp; i++)
        {
            printf("%.2f
    ",temar[i]-temar[i-1]);
        }
        printf("End of Output");
        return 0;
    }
    //法二
    scanf("%lf",&last);
    while(1)
    {
        scanf("%lf",&now);
        if(now == 999)
            break;
        printf("%.2f",now-last);
        last=now;
    }
    View Code

     没必要用数组

  • 相关阅读:
    A
    hdu 2108 Shape of HDU(判定是不是凸多边形)
    F
    J
    扩展欧几里得
    G
    A
    D
    E
    H
  • 原文地址:https://www.cnblogs.com/gabygoole/p/4585468.html
Copyright © 2011-2022 走看看