- ACM
讨论区
- @ 2025-11-17 19:04:11
公民在这可以发表自己的讨论但是要文明
13 条评论
-
gf24240 LV 7 MOD @ 2026-2-1 22:57:21#include <map> #include <random> #include <iostream> #include <algorithm> using namespace std; string Class3[50] = { "徐梓轩", "卢俊轩", "姜宜君", "林子航", "洪钰哲", "汤志晖", "卢子浩", "曾俊熙", "马瑞成", "缪易轩", "何政烽", "秦浩朗", "梁瀚天", "康施恩", "潘梓涛", "詹文晶", "卢俊桦", "黄任阳", "古忠睿", "黄皓霖", "张子亿", "曹睿", "莫晗", "余俊言", "江嘉辉", "陈子旺", "李雨晨", "刘子妍", "王孜文", "梁海桐", "徐靖唯", "漆梦丹", "陈宝仪", "陈俞澄", "death", "徐婧萱", "朱嘉妍", "温钰桐", "张芯圆", "黄诗雅", "death", "death", "周芸", "徐芷晴", "梁梓昕", "陈禹恒", "林日晖" }; struct stu { int a, b; stu() { a = 1; b = 16; } stu(int A, int B) { a = A; b = B; } }; bool operator<(const stu A, const stu B) { if (A.a != B.a)return A.a < B.a; return A.b < B.b; } map <stu, bool> coump; int randint(int l, int r) { static random_device rd; // 真随机数生成器(部分平台可能伪随机) static mt19937 gen(rd()); // 用真随机种子初始化 mt19937 引擎 uniform_int_distribution<int> dist(l, r); return dist(gen); } bool cmp(int a, int b) { return coump[stu(a, b)]; } int main() { while (1) { int i = randint(0, 46); while (Class3[i] == "death")i = randint(0, 46); int j = randint(0, 46); while (Class3[j] == "death" || j == i)j = randint(0, 46); cout << Class3[i] << " 和 " << Class3[j] << " ?\n" << "1. " << Class3[i] << ".\n" << "2. " << Class3[j] << ".\n" << "3. BREAK.\n"; int n; cin >> n; if (n == 1) { coump[stu(i, j)] = 0; coump[stu(j ,i)] = 1; } else if (n == 2) { coump[stu(i, j)] = 1; coump[stu(j, i)] = 0; } else break; } int cs[50]; for (int i = 0; i < 47; ++i)cs[i] = i; sort(cs, cs + 47, cmp); for (auto i : cs)cout << Class3[i] << "\n"; return 0; } -
@ 2026-1-31 12:08:22面壁者不需要对自己的行为作出任何解释。
* { opacity: 0 !important; transition: opacity 0.3s ease !important; } *:hover { opacity: 1.0 !important; } -
@ 2026-1-31 11:20:43让丁晓东以为你在打代码
#include <conio.h> #include <iostream> using namespace std; string prt = R"(ABCDEF)"; int main() { system("color F0"); int i = 0, n = prt.size(); while (i < n) { while (!_kbhit()); _getch(); cout << prt[i]; ++i; } return 0; }* { background-color: #fff0 !important; } p, span, font, h1, h2, h3, h4, h5, h6, div, li, ol, code, button, tspan, ul, select, input, label { color: #fff !important; font-weight: bold !important; text-shadow: 0 0 5px currentcolor; } a { color: #fff !important; font-weight: bold !important; text-shadow: 0 0 20px currentcolor, 0 0 30px currentcolor; } img { opacity: 0.1; } img:hover { opacity: 1.0; } body { background-color: #202020 !important; } -
@ 2025-12-22 19:13:07A test of
powin<cmath>and user define functionfast pow.#include <cmath> #include <chrono> #include <iostream> using namespace std; using namespace chrono; #define ll long long ll time() { auto now = high_resolution_clock::now(); return duration_cast<milliseconds>(now.time_since_epoch()).count(); } ll fpow(ll a, ll b, ll Mod) { if (b == 0)return 1; if (b == 1)return (a % Mod); ll h = fpow(a, (b >> 1), Mod) % Mod; if (b & 1)return (h * h * a) % Mod; return (h * h) % Mod; } int main() { ll a, b; while (cin >> a >> b) { int st = time(); int c = int(pow(a, b)) % 1145; cout << "\"pow\" function in <cmath>: "; if (c < 0)cout << "can't get right answer\n"; else cout << int(pow(a, b)) % 1145 << "\n"; int et = time(); cout << "use time: " << et - st << " ms\n\n"; st = time(); cout << "user define function \"fast pow\": " << fpow(a, b, 1145) << "\n"; et = time(); cout << "use time: " << et - st << " ms\n\n"; } return 0; } -
@ 2025-12-19 13:35:12 -
@ 2025-12-10 13:17:43 -
@ 2025-12-8 12:59:45/*鼠标样式*/ * { cursor: url(https://cdn.luogu.com.cn/upload/image_hosting/m0z68fn1.png), url(https://cdn.luogu.com.cn/upload/image_hosting/m0z68fn1.png), default !important; } -
@ 2025-12-7 18:50:38最长公共子序列细明
#include <iostream> #include <unordered_map> #define int long long using namespace std; const int N = 1e4 + 5; int n, m, dp[N][N]; string a, b; unordered_map <int, unordered_map <int, string> > lcs; signed main() { cin >> a >> b; n = a.size() - 1; m = b.size() - 1; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { if (a[i] == b[j]) { dp[i][j] = dp[i - 1][j - 1] + 1; lcs[i][j] = lcs[i - 1][j - 1] + a[i]; } else { dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]); if (dp[i][j] != dp[i - 1][j])lcs[i][j] = lcs[i][j - 1]; else lcs[i][j] = lcs[i - 1][j]; } } } cout << dp[n][m] << "\n" << lcs[n][m]; return 0; } -
@ 2025-12-7 18:50:37#include <bits/stdc++.h> using namespace std; string s1,s2; int n,m,dp[1005][1005]; int main() { cin>>s1>>s2; n=s1.size()-1; m=s2.size()-1; for(int i=1; i<=n; i++) { for(int j=1; j<=m; j++) { if(s1[i]==s2[j]) { dp[i][j]=dp[i-1][j-1]+1; }else{ dp[i][j]=max(dp[i-1][j],dp[i][j-1]); } } } cout<<dp[n][m]<<endl; string lcs; int i=n, j=m; while(i>0 && j>0) { if(s1[i]==s2[j]) { lcs=s1[i]+lcs; i--; j--; } else if(dp[i-1][j]>dp[i][j-1]) { i--; } else { j--; } } cout<<lcs; return 0; } -
@ 2025-12-5 19:22:46#include <bits/stdc++.h> using namespace std; int t; int n,C; int w[1005],c[1005],dp[1005]; int main(){ cin>>t; while(t--){ cin>>n>>C; for(int i=1;i<=n;i++)cin>>w[i]; for(int i=1;i<=n;i++)cin>>c[i]; for(int i=1;i<=n;i++){ for(int j=C;j>=w[i];j--){ dp[j]=max(dp[j],dp[j-w[i]]+c[i]); } } cout<<dp[C]<<"\n"; } return 0; } -
@ 2025-12-4 13:47:48可以用这个做 C++ 中文版
#include <random> #include <sstream> #include <iostream> #include <unordered_map> using namespace std; int randInt(int l, int r) { static random_device rd; static mt19937 gen(rd()); uniform_int_distribution<int> dist(l, r); return dist(gen); } unordered_map <string, string> def; // 宏替换,优先级最高 unordered_map <string, string> Turn; // 名转换,优先级最低 string GetEn(string en) { if (Turn.count(en))return Turn[en]; string ret = ""; // 随机生成名 int lenght = randInt(5, 15); // 长度(反正不是给人看的 char fstCh = randInt('A', 'Z'); --lenght; ret += fstCh; while (lenght--) { int type = randInt(1, 4); if (type == 1)ret += char(randInt('A', 'Z')); else if (type == 2)ret += char(randInt('a', 'z')); else if (type == 3)ret += char(randInt('0', '9')); else ret += '_'; } Turn[en] = ret; return ret; } string toEn(string str) { if (def.count(str))return toEn(def[str]); if (str == "#导入")return "#include"; if (str == "使用")return "using"; if (str == "命名空间")return "namespace"; if (str == "标准")return "std"; if (str == "主函数")return "main"; if (str == "《输入输出流》")return "<iostream>"; if (str == "无符号")return "unsigned"; if (str == "有符号")return "signed"; if (str == "整型")return "int"; if (str == "字符串")return "string"; if (str == "长整型")return "long long"; if (str == "常量")return "const"; if (str == "循环")return "for"; if (str == "如果成立则循环")return "while"; if (str == "返回")return "return"; if (str == "如果")return "if"; if (str == "输入")return "cin"; if (str == "输出")return "cout"; if (str == "或")return "||"; if (str == "且")return "&&"; if (str == "等于")return "=="; if (str == "小于等于")return "<="; if (str == "小于")return "<"; if (str == "大于")return ">"; if (str == "大于等于")return ">="; if (str == "不等于")return "!="; if (str == "加")return "+"; if (str == "加上")return "+="; if (str == "减")return "-"; if (str == "减去")return "-="; if (str == "自增")return "++"; if (str == "自减")return "--"; if (str == "为")return "="; if (str == "(")return "("; if (str == ")")return ")"; if (str == "()")return "()"; if (str == "【")return "["; if (str == "】")return "]"; if (str == ";")return ";"; if (str == "》》")return ">>"; if (str == "《《")return "<<"; if (str == ",")return ","; if (str == "?")return "?"; if (str == "!")return "!"; if (str == "“" || str == "”")return "\""; if (str == "{" || str == "}" || (str[0] >= '0' && str[0] <= '9'))return str; if (str[0] == '\\')return str.substr(1, str.size() - 1); return GetEn(str); // 变量名 } int main() { freopen("code.in", "r", stdin); freopen("英文版.txt", "w", stdout); int Tabn = 0; string line; while (getline(cin, line)) { stringstream sss(line); stringstream ss2(line); string inp, tab; while (ss2 >> tab)if (tab == "}")--Tabn; for (int i = 1; i <= Tabn; ++i)cout << "\t"; bool flag = 1; while (sss >> inp) { if (inp == "#替换") { string bef, aft; sss >> bef >> aft; def[bef] = aft; flag = 0; continue; } if (inp == "{")++Tabn; cout << toEn(inp) << " "; } if (flag)cout << "\n"; } return 0; }输入问题就能得到 AI 的回答(false)
#include <bits/stdc++.h> using namespace std; int main() { string a; getline(cin, a); a = "start https://chat.baidu.com/search?word=" + a; system(a.c_str()); system("exit"); return 0; }可以生成你在洛谷练习的表格
#include <map> #include <iostream> #include <algorithm> using namespace std; int n = 8; string names[10] = {"", "暂无评定", "入门", "普及-", "普及/提高-", "普及+/提高", "提高+/省选-", "省选/NOI-", "NOI/NOI+/CTSC"}; string colors[10] = {"", "#bfbfbf", "#fe4c61", "#f39c11", "#ffc116", "#52c41a", "#3498db", "#9d3dcf", "#0e1d69"}; int lens[10], socs[10]; struct stu { int name; int soc, len; }a[10]; bool cmp(stu x, stu y) { return x.soc > y.soc; } void print(int name, int len) { cout << "\\textbf{" << names[name] << "} &: \\color{#ffffff}\\colorbox{" << colors[name] << "}{\\hspace{" << len / 20.0 << "cm}" << socs[name] << "\\hspace{" << len / 20.0 << "cm}} \\\\" << endl; } int main() { //ios::sync_with_stdio(0); //cin.tie(0); cout.tie(0); for (int i = 1; i <= n; ++i) { cin >> a[i].soc; socs[i] = a[i].soc; a[i].name = i; if (a[i].soc == 0)a[i].soc = -1; } sort(a + 1, a + 9, cmp); a[1].len = 100; for (int i = 2; i <= n; ++i) { a[i].len = a[i].soc * a[i - 1].len / a[i - 1].soc; } for (int i = 1; i <= n; ++i) { lens[a[i].name] = a[i].len; } cout << "\\boxed{" << endl; cout << "\\begin{aligned}" << endl; for (int i = 1; i <= n; ++i) { print(i, lens[i]); } cout << "\\end{aligned}" << endl; cout << "}"; return 0; } -
@ 2025-12-3 19:22:44得到题目 Markdown
注:须下载
#!/usr/bin/env python3 """ by jason 2025-07-26 copyright wanwusangzhi 2024-2025 """ import requests, re, sys from bs4 import BeautifulSoup import html2text # ========== 按需修改 ========== BASE_URL = "https://www.bcoi.cn/d/gf24" # 你的站点根域名 LOGIN_URL = f'{BASE_URL}/login' # login page Problem_ID = "food2" HOME_URL = f'{BASE_URL}/p/{Problem_ID}' USERNAME = "" # 你的账号 PASSWORD = "" # 你的密码 # =============================== def main(): s = requests.Session() s.headers.update({ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) ' 'AppleWebKit/537.36 (KHTML, like Gecko) ' 'Chrome/120.0.0.0 Safari/537.36' }) # 1. 拉登录页,取 csrf login_html = s.get(LOGIN_URL).text soup = BeautifulSoup(login_html, 'lxml') csrf = (soup.find('meta', attrs={'name': 'csrf-token'}) or soup.find('input', attrs={'name': re.compile(r'csrf|_csrf')})) if csrf: csrf = csrf.get('content') or csrf['value'] else: csrf = '' # 站点没开 csrf 验证 # 2. 提交账号密码 resp = s.post(LOGIN_URL, data={ 'uname': USERNAME, 'password': PASSWORD, '_csrf': csrf }, allow_redirects=False) if resp.status_code != 302: raise RuntimeError('登录失败,请检查账号密码或抓包核对字段名') # 3. 登录成功后拿首页 home_html = s.get(HOME_URL).text soup = BeautifulSoup(home_html, 'html.parser') for katex_span in soup.find_all('span', class_='katex'): annotation = katex_span.find('annotation') if annotation: katex_span.replace_with(f"${annotation.text}$") # 可选:加 $ 变成 LaTeX 公式 # 查找class="problem-content"的div problem_content = soup.find('div', class_='problem-content') html=problem_content print(html) # 创建 html2text 处理器 h = html2text.HTML2Text() h.ignore_links = False # 不忽略链接 h.bypass_tables = False # 不忽略表格 h.ignore_images = False # 不忽略图片 h.body_width = 0 # 不自动换行 # 转换 HTML 为 Markdown markdown = h.handle(str(html)) print(markdown) with open("p.md","w",encoding='utf-8') as f: f.write(markdown) if __name__ == '__main__': main() -
@ 2025-11-17 20:07:41不建议给讨论乱加无关标签
- 1