#include<bits/stdc++.h> // 考试万能头文件
题目指定测试数据组数时: while(T–)
题目未指定输入长度时: while(cin >> a) , 注意cin以空格或回车作为分隔符
读入不确定行数的字符串,以空行作为结束:
vector<string> sv; string s; while(getline(cin, s)){ if(s.empty()) break; sv.emplace_back(move(s)); }读入带分隔符的字符串:
string s; getline(cin, s); istringstream iss(s); vector<string> sv; while(getline(iss, s, ',')) // 用 while(iss >> s) 是不行的 sv.emplace_back(move(s));int 型: 1 ≤ N ≤ 1 0 9 1 \le N \le 10^9 1≤N≤109
long long 型: 1 0 9 ≤ N ≤ 1 0 18 10^9 \le N \le 10^{18} 109≤N≤1018
浮点一律使用 double
O ( n 2 ) O(n^2) O(n2) 算法只能用于 N ≤ 1000 N \le 1000 N≤1000 规模的数据,超过 1 0 4 10^4 104 必须改为 O ( n ) O(n) O(n) 或更优的算法.
空间复杂度: 数组一般不能超过 1 0 6 10^6 106