最近在打cf时赛后翻阅别人的代码总是会发现一个陌生而奇怪的头文件#include<bits/stdc++.h>
奇怪之处就在于基本上所有的代码只要用了这个头文件就不再写其他头文件了。
百度过后仿佛打开了新世界的大门,头文件居然还可以这样用!!!
#include<bits/stdc++.h>包含了目前c++所包含的所有头文件!!!!
从此开启开挂般的人生啊!!
现在再看下面这一堆乱七八糟的头文件显得莫名的冗杂:
1 #include <iostream> 2 #include <cstdio> 3 #include <fstream> 4 #include <algorithm> 5 #include <cmath> 6 #include <deque> 7 #include <vector> 8 #include <queue> 9 #include <string> 10 #include <cstring> 11 #include <map> 12 #include <stack> 13 #include <set> 14 using namespace std; 15 16 int main(){ 17 18 return 0; 19 }
再看我们开挂以后:
1 #include<bits/stdc++.h> 2 using namespace std; 3 4 int main(){ 5 6 return 0; 7 }
简洁明了啊是不是 一眼望穿啊是不是 心动了是不是 大脑充血了是不是 幸福昏厥了是不是 再也不用担心CE了是不是!!!
谈一下朋友们担心的兼容性问题,一早起来跑了几个oj亲测兼容性还是蛮强的,看到去年的介绍博客表示hdu不支持不过现在亲测已经支持了,请在hdu肆无忌惮的开挂吧!!
不过...去年不支持的poj如今也还是不支持:
p.s.
Language要选择G++
当然国外的主流oj,台湾的oj,Codeforces和Topcoder这些去年就已经支持#include<bits/stdc++.h>的oj如今也依旧支持。
当然我也是资辞滴( ̄︶ ̄)↗
此处附上源码
// C++ includes used for precompiling -*- C++ -*-
// Copyright (C) 2003-2014 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
/** @file stdc++.h
* This is an implementation file for a precompiled header.
*/
// 17.4.1.2 Headers
// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
转载出处:https://www.cnblogs.com/Kiven5197/p/5745589.html