2008,值得回顾

来源:互联网 发布:chec能耗分析软件 编辑:程序博客网 时间:2024/05/21 22:21

收获:

1、一定要细心再细心,是什么类型就用什么类型输入,不要所有的东西都%d!

2、尽量少用数组少定义变量,能节省空间就节省!多去看讨论,大神的精简代码屌炸了!

3、三目运算符:计算式?A:B;,计算式为真则取A,否则取B。

4、不要犯低级错误!




#include "stdio.h"int main(){        double m;        int n,Minus,Integers,Zero;    while(scanf("%d",&n),n!=0)    {                Minus=0,Zero=0,Integers=0;        while(n--)        {            scanf("%lf",&m);            if(m==0)            ++Zero;            else            m<0?Minus++:Integers++;        }        printf("%d %d %d\n",Minus,Zero,Integers);    }


0 0
原创粉丝点击