世界不断发展,各种电子设备不断变得更加迷你,代码却越写越长……
A+B Problem
Input:Two integer A,B
Output:The ans of A+B
1971年,Niklaus Wirth 发明 Pascal
越是早年的语言,内存与运行时间越少,代码也越简单
var a,b:longint;
begin
readln(a,b);
writeln(a+b)
end.
1983 年 C++ 在 Bjarne Stroustrup 手中诞生
主要特点是尽量兼容C,且支持面向对象
#include<iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
return ;
}
1995 年 Sun Microsystems 通过改进 C++ 发明了 Java
不难看出 Java 有很多与 C++ 相似的地方
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
Scanner in=new Scanner(System.in);
int a=in.nextInt();
int b=in.nextInt();
System.out.println((a+b));
}
}
重点是代码长度从 5行→9行→11行
设想 N 年后的代码,会是多少行?
(不过 Python 成功打破了这一规律)