08 2024 档案
摘要:模拟过程走一遍即可 #include <bits/stdc++.h> using namespace std; const int N = 110; int M[N]; #define x first #define y second int main() { int n; cin >> n; in
阅读全文
摘要:硬写的 // 我也不知道多长时间了,估计有40min #include <bits/stdc++.h> using namespace std; const int N = 50; int hou[N], zhong[N]; class Node { public: int val; int wei
阅读全文
摘要:并查集 int p[N]; // 储存祖宗节点 int cnt[N]; // 用于统计集合元素个数 bool flag[N]; // 储存节点是否出现 init函数 void init() { for(int i = 1; i <= N; ++ i) { p[i] = i; cnt[i] = 1;
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; // 分别为祖宗节点,人数,房子数,总面积 int p[N], cnt[N], fangzi[N], totalarea[N], minnum[N]; // 编
阅读全文
摘要:基础款并查集练习题 // 13'11" #include <bits/stdc++.h> using namespace std; const int N = 1e4 + 10; int p[N], f[N]; void init() { for(int i = 1; i <= N; ++ i) p
阅读全文
摘要:时间复杂度 N*M≈2.5e6 #include <bits/stdc++.h> using namespace std; int n = 510, m; const int N = 510; vector<pair<int,int>> path; // 储存所有边 int p[N]; // 储存祖
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 1000; int p[N]; int find(int x) { if(p[x] != x) p[x] = find(p[x]); return p[x]; } int main
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; int arr[10][10]; int main() { int n; cin >> n; for(int t = 1; t <= n; ++ t) { for(int j = 1; j <= 9; ++
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; #define int long long int func(int n) { int res = 0; while(n >= 10) { int a = n; vector<int> num; while(
阅读全文
摘要:#include <bits/stdc++.h> using namespace std; const int N = 110; double price[N]; int total[N]; int main() { int n; cin >> n; for(int i = 1; i <= n; +
阅读全文
摘要:思路可能不太对,但是确实是过了 #include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int sum = 0; int minm = 999999; for(int i = 1; i <
阅读全文
摘要:不会写可以switch把所有情况全写出来,总共只有六种不多 // 4'05" #include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; if(b == 1 || b == 0 && a == 2) c
阅读全文
摘要:// 1'02" #include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; cout << b - a; return 0; }
阅读全文
摘要:print("Problem? The Solution: Programming.")
阅读全文
摘要:ez // 5'46" #include <bits/stdc++.h> using namespace std; bool func(int a, int b) { int sum = 0; while(a) { sum += a % 10; a /= 10; } return b % sum;
阅读全文
摘要:想得太复杂,这道题不会卡你人数为0时候的情况,不要忘记题目的条件:不允许单人住一间寝室 // 32'41" #include <bits/stdc++.h> using namespace std; map<int,bool> div(int x) { map<int,bool> hash; if(
阅读全文
摘要:// 6'11" #include <bits/stdc++.h> using namespace std; const int N = 110; int a[N]; int main() { int n; cin >> n; for(int i = 1; i <= n; ++ i) cin >>
阅读全文
摘要:// 1'58" #include <iostream> using namespace std; int main() { int n; cin >> n; for(int i = 1; i <= n; ++ i) { int a, b, c; cin >> a >> b >> c; if(c =
阅读全文
摘要:// 2'35" #include <iostream> using namespace std; int main() { int n, m, k; string x; cin >> n >> x >> m >> k; if(k == n) cout << "mei you mai " << x
阅读全文
摘要:// 1'18" #include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int s = a + b; cout << s - 16 << endl << s - 3 << endl << s -
阅读全文
摘要:print("Good code is its own best documentation.")
阅读全文
摘要:注意有大坑:题目没有说,如果同一个书号出现两个'S',按照后者记时(一本书在未归还时被多次借出,记录取后者)。 // long #include <bits/stdc++.h> using namespace std; #define x first #define y second int mai
阅读全文
摘要:题目描述弯弯绕绕,总结如下:天梯赛分数不够的直接不要,PAT面试分数够s的直接要,剩余人分数相同的只要k个。 // 13'55" #include <bits/stdc++.h> using namespace std; int main() { int n, k, s; cin >> n >> k
阅读全文
摘要:无论技能释放在哪一行,并不影响剩余格子数量,只需统计出现了多少不同的行和列 #include <bits/stdc++.h> using namespace std; int main() { int n, m, q; cin >> n >> m >> q; map<int,bool> hash1,
阅读全文
摘要:// 4'34" #include <bits/stdc++.h> using namespace std; string func(string s) { string res; for(int i = 1; i < s.size(); ++ i) if((s[i] - '0') % 2 == (
阅读全文
摘要:// 10'30" #include <bits/stdc++.h> using namespace std; bool arr[10][10]; int main() { for(int i = 1; i <= 6; ++ i) { int tmp; cin >> tmp; arr[i][tmp]
阅读全文
摘要:// 1'21" #include <iostream> using namespace std; #define int long long signed main() { int n, m; cin >> n >> m; int s = n + m; int sum = 1; for(int i
阅读全文
摘要:逆天10分题,做题细心一点 // 10'16" #include <bits/stdc++.h> using namespace std; int main() { int jin, pei, xun1, xun2; cin >> jin >> pei >> xun1 >> xun2; int m
阅读全文
摘要:// 49" #include <iostream> using namespace std; int main() { int n, v; cin >> n >> v; cout << n / v; return 0; } ···
阅读全文
摘要:前天 != 前一天(笑) print("I'm gonna win! Today!") print("2022-04-23")
阅读全文
摘要:注意:不是每次找数组最后两个元素做乘积! // 11'39" #include <bits/stdc++.h> using namespace std; void func(vector<int>& v, int now) { int num = v[now] * v[now - 1]; vecto
阅读全文
摘要:获取map的第一个和最后一个元素,分别使用begin()和-- end()访问。 // 9'21" #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int,int> hash; for(i
阅读全文
摘要:如果是测试点2卡住的话,可以试试以下样例。 输入样例 : 5 2 easy L1 easy L2 easy L3 ez L4 ez L5 输出样例 : Wo AK le 代码: // long #include <bits/stdc++.h> using namespace std; bool fu
阅读全文
摘要:// 5'04" #include <bits/stdc++.h> using namespace std; const int N = 24; int arr[N]; int main() { for(int i = 0; i <= 23; ++ i) cin >> arr[i]; int num
阅读全文
摘要:// 1'56" #include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for(int i = 1; i <= n; ++ i) { double d; cin >> d; if(d <
阅读全文
摘要:// 4'01" #include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; if(s.size() == 4) { int num = (s[0] - '0') * 10 + s[1] - '0';
阅读全文
摘要:// 1'48" #include <iostream> using namespace std; int main() { int n, k, m; cin >> n >> k >> m; int res = (n - k * m > 0) ? n - k * m : 0; cout << res
阅读全文
摘要:print("To iterate is human, to recurse divine.")
阅读全文
摘要:// 34'18" #include <bits/stdc++.h> using namespace std; int arr[3][3]; int open[3][3]; map<int,int> hash; int firx = 1, firy = 1, firv = 1; void init(
阅读全文
摘要:转换成2进制,n表示1,y表示0。 // 4'39" #include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; for(int i = 1; i <= m; ++ i) { int res
阅读全文
摘要:foundPos == std::string::npos // 说明没有查找到 // 9'15" #include <bits/stdc++.h> using namespace std; int main() { string s; int cnt = 0, first = 0, potcnt
阅读全文
摘要:// 15'0" #include <bits/stdc++.h> using namespace std; int main() { int arr[6], flag[6]; int total = 0; int m = 0; // max for(int i = 0; i < 6; ++ i)
阅读全文
摘要:// 2'4" #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long double res = 0; for(int i = 1; i <= n; ++ i) { long double x;
阅读全文
摘要:// 8'30" #include <bits/stdc++.h> using namespace std; int main() { double a, c; int b; cin >> a >> b >> c; double res = (a / c) * (b == 0 ? (double)2
阅读全文
摘要://43" #include <iostream> int main() { int a, b, c; std::cin >> a >> b >> c; std::cout << a*b*c; return 0; }
阅读全文
摘要:使用sstream分割句子! // 13'51" #include <bits/stdc++.h> using namespace std; vector<string> split(string str, char c) { vector<string> res; istringstream st
阅读全文
摘要:print("Talk is cheap. Show me the code.")
阅读全文
摘要:// 6'00" #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for(int i = 1; i <= n; ++ i) { int gen, h, w; cin >> gen >> h >>
阅读全文
摘要:// 4'56" #include <bits/stdc++.h> using namespace std; bool func(string s) { int sum1 = 0, sum2 = 0; for(int i = 0; i <= 2; ++ i) sum1 += s[i] - '0';
阅读全文
摘要:注意: 是 体重(kg) / (身高(m) 的平方) 不是 (体重(kg) / 身高(m)) 的平方 // 4'56" #include <bits/stdc++.h> using namespace std; int main() { double w, h; cin >> w >> h; dou
阅读全文
摘要:// 3'56" #include <iostream> using namespace std; int main() { int x, y; cin >> x >> y; cout << 100 * 50 - ((100 - x) * y) - (x * y) / 2- ((100 - x) *
阅读全文
摘要:// 5'35" #include <bits/stdc++.h> using namespace std; int main() { string s; getline(cin,s); for(int i = 0; i < s.size(); ++ i) { if(s[i] != '6') cou
阅读全文
摘要:print("PTA shi3 wo3 jing1 shen2 huan4 fa1 !")
阅读全文
摘要:// 8'43" #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; double avg = 0; map<int,string> hash; int ans = 0; for(int i = 1;
阅读全文
摘要:// 7'18" #include <iostream> using namespace std; int main() { int pa, pb; cin >> pa >> pb; int p1, p2, p3; cin >> p1 >> p2 >> p3; bool awin = false;
阅读全文
摘要:输入->判断正反是否一致->输出 // 11'43" #include <bits/stdc++.h> using namespace std; int main() { char ch; int n; cin >> ch >> n; vector<string> v; string emp; ge
阅读全文
摘要:// 1'4" #include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; for(int i = 1; i <= a + b; ++ i) cout << "Wang!"; return 0; }
阅读全文
摘要:// 34" #include <iostream> using namespace std; int main() { cout << "2018\nwo3 men2 yao4 ying2 !"; return 0; }
阅读全文
摘要:// 1'16" #include <bits/stdc++.h> using namespace std; int main() { double a, b; cin >> a >> b; b /= 10; cout << fixed << setprecision(2) << a * b; re
阅读全文
摘要:注意:每一个字符串都是L位的 // 10'30" #include <bits/stdc++.h> using namespace std; #define int long long void print(int x, int l) { vector<int> v; for(int i = 1;
阅读全文
摘要:// 10'42" #include <iostream> using namespace std; const int N = 110; int arr[N][N]; int brr[N][N]; int crr[N][N]; int main() { int x1, y1; cin >> x1
阅读全文
摘要:// 2'55" #include <iostream> using namespace std; int main() { int n; cin >> n; for(int i = 1; i <= n; ++ i) { string s; int huxi, maibo; cin >> s >>
阅读全文
摘要:x = int(input()) guanggun = 1 cnt = 1 while (guanggun % x) != 0 : guanggun = guanggun * 10 + 1 cnt = cnt + 1 print(guanggun // x,cnt)
阅读全文
摘要:// 37" #include <iostream> using namespace std; int main() { string s; cin >> s; cout << "Hello " << s; return 0; }
阅读全文
摘要:// 5'33" #include <iostream> using namespace std; int main() { int k; cin >> k; string s; int cnt = 1; while(cin >> s) { if(s == "End") break; if((cnt
阅读全文
摘要:// 1'39" #include <iostream> using namespace std; int main() { string s; cin >> s; for(int i = 6; i <= 9; ++ i) cout << s[i]; cout << "-"; for(int i =
阅读全文
摘要:// 1'35" #include <iostream> using namespace std; int main() { int n; int cnt = 1; while(cin >> n) { if(n == 250) { cout << cnt; break; } else ++ cnt;
阅读全文
摘要:// 2'40" #include <iostream> #include <iomanip> using namespace std; int main() { int n; cin >> n; for(int i = 1; i <= n; ++ i) { char c; double d; ci
阅读全文
摘要:因为每一列字符数固定,因此只需要根据字符在字符串第i个位置mod n,就可以知道在第几行。最后每一行字符串逆序输出,并补充最后一行的空格即可。 // 17'26" #include <bits/stdc++.h> using namespace std; int main() { int n; st
阅读全文
摘要:## 22" print("Hello World") print("Hello New World")
阅读全文
摘要:有点坑的10分题,读题不仔细会WA几次 // 4'58" #include <iostream> #include <iomanip> using namespace std; int main() { int a, b; cin >> a >> b; cout << a << "/"; if(b
阅读全文
摘要:// 26" #include <iostream> using namespace std; int main() { int a, nb; cin >> a >> nb; cout << a * nb; return 0; }
阅读全文
摘要:// 3'42" #include <bits/stdc++.h> using namespace std; int main() { vector<string> v; string str; while(cin >> str) { if(str == ".") break; v.push_bac
阅读全文
摘要:// 6'22" #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int,int> hash; for(int i = 1; i <= n; ++ i) { int k; cin >> k
阅读全文
摘要:注意:所谓 n个数字都不相同 是指不同的数字正好是n个。 // 9'14" #include <iostream> #include <set> #include <iomanip> using namespace std; bool func(int i, int n) { set<int> se
阅读全文
摘要:// 6'42" #include <iostream> using namespace std; int main() { int n; cin >> n; string tmp; getline(cin,tmp); char c1 = tmp[1]; string s; getline(cin,
阅读全文
摘要:注意单位! #include <iostream> #include <cmath> using namespace std; int main() { int n; cin >> n; for(int i = 1; i <= n; ++ i) { int h, w; cin >> h >> w;
阅读全文
摘要:// 11'52" #include <iostream> #include <vector> using namespace std; int main() { int n; cin >> n; vector<pair<int,string>> qian; vector<pair<int,stri
阅读全文
摘要:注意读题,心急吃不了热豆腐。 // 1'20" #include <iostream> #include <iomanip> using namespace std; int main() { int h; cin >> h; cout << fixed << setprecision(1) <<
阅读全文
摘要:直接背素数板子 // 1'58" #include <iostream> using namespace std; bool func(int n) { if(n <= 1) return false; if(n == 2) return true; for(int i = 2; i <= n /
阅读全文
摘要:用哈希快速访问找到下标 // 8'33" #include <bits/stdc++.h> using namespace std; int arr[100]; int main() { map<int,int> hash; string s; cin >> s; for(auto c : s) a
阅读全文
摘要:print("""I L o v e G P L T""")
阅读全文
摘要:很史的一道题,没有ac的话建议混多半分直接跳。 读入最好使用getline,再用substr分割字符串。 // 15'00" #include <iostream> #include <string> using namespace std; int add(string a,string b) {
阅读全文
摘要:// 1'17" #include <iostream> using namespace std; int main() { int n; cin >> n; n += 2; n %= 7; if(n == 0) n += 7; cout << n; return 0; }
阅读全文
摘要:1e4直接暴力,能过就行不用优化。 // 5'50" #include <iostream> #include <map> using namespace std; int main() { string s; cin >> s; map<char,int> hash; for(auto c : s
阅读全文
摘要:// 1'45" #include <iostream> using namespace std; int main() { int n; cin >> n; int cnt1 = 0, cnt2 = 0; while(n --) { int tmp; cin >> tmp; if(tmp % 2
阅读全文