zoukankan      html  css  js  c++  java
  • BOJ 83 A + B Problem

    时间限制 1000 ms 内存限制 65536 KB

    题目描述

    Calculate the sum of two given integers A and B.

    输入格式

    The input consists of a line with A and B(10^4A,B10^4).

    输出格式

    Output the only answer.

    输入样例

    2 3

    输出样例

    5


    #include<stdio.h>
     
     int main(){
        int a,b;
        scanf("%d %d",&a,&b);
        printf("%d",a+b);
        return 0;
     }

    忘写“ ”了,虽然也通过了但是查看时发现只走了一个测试用例,得了10分。

    #include <stdio.h> 
        
    main() 
    { 
        int a,b; 
        while(scanf("%d%d",&a,&b)!=EOF) 
            printf("%d
    ",a+b); 
        return 0; 
    } 

    EOF不要倒也没什么影响。

    话说C++里怎么判断EOF啊。。。o(╯□╰)o

    男票说C用main()不用 int main(),BOJ上都OK,不过搜了一下,C89 接受main(),C99只有两种:

      int main(void)

      int main(int argc, char *argv[])

    C++98中定义了如下两种main函数的定义方式:

      int main( )

      int main(int argc, char *argv[])


    从来都没写过int main (void)的路过……总之!记住main 只接受int 返回值就是啦!

    另外return 0 时不时会忘,查了一下一般会自动补齐,不过有的不会……So,莫再忘啦。

     
     
    ________你所记的,都是假的。
  • 相关阅读:
    UESTC
    Education Round 8 A
    Gym
    Gym
    hdoj 1159 Common Subsequence
    UVA
    UESTC
    51Nod 1068 Bash游戏 V3 (这规律不好找)
    51Nod 1066 Bash游戏
    51Nod 1002 数塔取数问题
  • 原文地址:https://www.cnblogs.com/pudding-ai/p/3676505.html
Copyright © 2011-2022 走看看