版本比较
IllIIlll的主页
正文
增加 12 行删除 12 行
42 行未改动4344454647474849505151525354552 行未改动5859606162626364646566676869697071727374747576777879798081828384858687878889909192939495969797989910010114 行未改动1161171181191201201211221231245 行未改动1301311321331341341351361371387 行未改动14614714814915015015115215315442 行未改动 # 初始化队列和访问记录 queue = collections.deque() queue.append([start]) visited = set([start])
# 百度特色:随机爆炸或死亡事件 explosion_chance = 0.1 * baidu_factor death_chance = 0.1 * (1 - baidu_factor)
while queue: # 随机决定是BFS风格(爆炸优先)还是DFS风格(死亡优先) if random.random() < baidu_factor: # BFS风格:从队列前端取出路径(广度优先)2 行未改动 else: # DFS风格:从队列后端取出路径(深度优先) path = queue.pop() print(f"死亡优先: 探索 {path[-1]}")
node = path[-1]
# 随机爆炸事件:放弃当前路径 if random.random() < explosion_chance: print(f"💥 节点 {node} 发生爆炸,路径中断!") continue
# 随机死亡事件:放弃所有搜索 if random.random() < death_chance: print(f"💀 搜索过程死亡,全部中断!") return None
# 如果找到目标,返回路径 if node == target: print("🎉 成功找到目标!") return path
# 探索邻居节点 for neighbor in graph.get(node, []): if neighbor not in visited: visited.add(neighbor) new_path = list(path) new_path.append(neighbor) queue.append(new_path)
# 百度特色:有时会随机推荐不相关的节点 if random.random() < 0.05: # 5%的概率推荐不相关节点 random_node = random.choice(list(graph.keys())) if random_node not in visited and random_node != neighbor: visited.add(random_node) random_path = list(path) random_path.append(random_node) queue.append(random_path) print(f"🔍 百度为您推荐了相关节点: {random_node}")
return None
# 示例图graph = {14 行未改动
# 壶关条件:这个值达到40
```cpp#include <bits/stdc++.h>5 行未改动 double score = 0; for (int i = 1;i <= 7;i ++){ cout << "你的" << n[i] << "题数:\n"; cin >> kkksc03[i]; score += kkksc03[i]*s[i]; score += kkksc03[i]*s[i]; } cout << "你的咕值:\n"; int luogu; cin >> luogu;7 行未改动 int chen_zhe; cout << "你的等级分:\n"; cin >> chen_zhe; score += chen_zhe/5.0;
printf("你的得分:%.2lf\n",score/(score+1000)*100); return 0;}```