fork download
  1.  
  2. #include <iostream>
  3. #include <string>
  4. #include <vector>
  5.  
  6. using namespace std;
  7.  
  8. void runAssessment(string target) {
  9. string cat, risk, impact, suggestion;
  10.  
  11. // --- 环境化学专业级识别矩阵 ---
  12.  
  13. // 1. 有害垃圾 (新增化学试剂:酸、碱、汞试剂、苯、氯仿等)
  14. if (target.find("电池") != string::npos || target.find("药") != string::npos ||
  15. target.find("汞") != string::npos || target.find("酸") != string::npos ||
  16. target.find("碱") != string::npos || target.find("苯") != string::npos ||
  17. target.find("氯仿") != string::npos || target.find("试剂") != string::npos) {
  18.  
  19. cat = "有害垃圾 (Hazardous / Chemical Waste)";
  20. risk = "强腐蚀性、剧毒或具有潜在致癌性的化学物质。";
  21. impact = "可能改变土壤pH值,或通过挥发造成大气光化学烟雾污染,具有高环境持久性。";
  22. suggestion = "严格分类!严禁倒入下水道!需装入专用化学废液桶,分类暂存。";
  23. }
  24. // 2. 可回收物 (维持原有逻辑,增加金属实验室耗材)
  25. else if (target.find("瓶") != string::npos || target.find("纸") != string::npos ||
  26. target.find("塑料") != string::npos || target.find("铝") != string::npos ||
  27. target.find("金属") != string::npos || target.find("罐") != string::npos) {
  28.  
  29. cat = "可回收物 (Recyclable)";
  30. risk = "可再利用的聚合物或无机金属材料。";
  31. impact = "资源化利用可减少生产过程中的‘碳足迹’及矿产资源枯竭风险。";
  32. suggestion = "确保无化学残留后投放至蓝色桶。";
  33. }
  34. // 3. 厨余垃圾 (生物质)
  35. else if (target.find("皮") != string::npos || target.find("菜") != string::npos ||
  36. target.find("果") != string::npos || target.find("剩") != string::npos) {
  37.  
  38. cat = "厨余垃圾 (Food Waste)";
  39. risk = "易降解有机碳源。";
  40. impact = "填埋产生的渗滤液COD极高,建议通过生物处理降低环境负荷。";
  41. suggestion = "投放至绿色桶。";
  42. }
  43. // 4. 其他垃圾 (增加实验室碎玻璃、废弃纸巾)
  44. else if (target.find("烟") != string::npos || target.find("陶瓷") != string::npos ||
  45. target.find("纸巾") != string::npos || target.find("碗") != string::npos ||
  46. target.find("碎玻璃") != string::npos) {
  47.  
  48. cat = "其他垃圾 (Residual)";
  49. risk = "性质相对稳定的无机残留物。";
  50. impact = "无法自然降解,主要通过末端焚烧实现无害化。";
  51. suggestion = "投放至灰色桶(碎玻璃请包裹好防止割伤)。";
  52. }
  53. else {
  54. cat = "未知/待评估物质";
  55. risk = "需进行理化性质鉴定。";
  56. impact = "建议参考该物质的 MSDS (化学品安全技术说明书)。";
  57. suggestion = "暂按危险废弃物预处理。";
  58. }
  59.  
  60. cout << "\n[鉴定结论]: " << cat << endl;
  61. cout << "------------------------------------------" << endl;
  62. cout << "【化学风险】: " << risk << endl;
  63. cout << "【环境影响报告】: " << impact << endl;
  64. cout << "【专业处理建议】: " << suggestion << endl;
  65. }
  66.  
  67. int main() {
  68. string userInput;
  69. cout << "Environmental Chemistry: Hazardous Substance Manager v3.0" << endl;
  70. cout << "Ready for Chemical Identification..." << endl;
  71.  
  72. if (!(cin >> userInput)) userInput = "未知";
  73.  
  74. runAssessment(userInput);
  75. return 0;
  76. }
  77.  
Success #stdin #stdout 0s 5304KB
stdin
香蕉皮
stdout
Environmental Chemistry: Hazardous Substance Manager v3.0
Ready for Chemical Identification...

[鉴定结论]: 厨余垃圾 (Food Waste)
------------------------------------------
【化学风险】: 易降解有机碳源。
【环境影响报告】: 填埋产生的渗滤液COD极高,建议通过生物处理降低环境负荷。
【专业处理建议】: 投放至绿色桶。