最短C++11代码诞生!

P1001 A+B Problem

lucas1522 @ 2020-01-27 21:30:52

输入迭代器,您值得拥有

#include<bits/stdc++.h>
std::istream_iterator<int> in(std::cin),eof;
main(){
    std::cout<<std::accumulate(in,eof,0);
}

by _Time_Limit_Error_ @ 2020-02-17 07:34:17

@BAN_Ba1 hhh


by 屑稻香 @ 2020-02-18 16:25:58

main(){return 0;}

by 抹不掉的轻狂 @ 2020-02-21 14:39:57

最短代码没说要AC啊(逃


by CarroT1212 @ 2020-02-24 18:16:48

所以还是不太方便,要Ctrl+d


by yzy1 @ 2020-03-08 17:59:34

main(n){gets(&n);printf("%d",n%85-43);}

C 语言, 只有 39 个字符.


by xrdrsp @ 2020-03-22 13:25:02

var a,b:int64;begin read(a,b);write(a+b);end.

pascal 45b


by ttt1493b @ 2020-04-01 11:03:07

??前排


by SlimMathers @ 2020-04-12 11:59:49

来个较长的

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a[1000]={0},b[1000]={0},c[1001]={0};
    string str1,str2; cin>>str1>>str2;
    int len1 = str1.length(),len2 = str2. length();
    for(int i = 0;i<len1;i++)
    a[i] = str1[len1-1-i] - '0';
    for(int i = 0;i<len2;i++)
    b[i] = str2[len2-1-i] - '0';
    int maxl = len1> len2?len1:len2; //相加后的位数。
    for(int i = 0;i<maxl;i++){
    c[i] += a[i]+b[i];
    if (c[i] >= 10){
         // 处理进位。
        c[i]%=10; ++c[i+1] ;
        }
    }
    for(int i=maxl-1;i>=0;i--) cout<<c[i];
    return 0;
}

高精度


by ADay @ 2020-04-25 20:55:31

Py:64B print(sum(map(int,input().split())))


by Alan_Zhao @ 2020-06-25 21:38:39

print int(input())+int(input())


上一页 | 下一页