Java在全球用的不算少:
C++1946次提交,java111次提交
C++1904次提交, java161 次提交
C++1415 次提交,java74次提交
几个很著名的Java手:
C++相较于Java的优势:
(1)STL容器或函数比Java标准库丰富,如acm中常用的:
std::multimap
std::multiset
std::unique()
std::upper_bound()
std::lower_bound()
std::next_permutation()
std::pair
std::swap()
这几个常用的容器或函数,JAVA标准库中是没有的(注意,JAVA标准库中有Collections.swap(List> arg, int arg0, int arg1))
(2)C++ 有unsigned long long ,JAVA没有,导致部分hash算法用JAVA很难搞。
(3)语言本身导致的代码长度,一般JAVA会稍长,如:
JAVA:
Map cnt = new HashMap() ;
Integer t = cnt.get("laoli") ;
cnt.put("laoli", 1 + (t == null ? 0 : t)) ;
C++:
std::map<:string int> cnt