首页 > 最小循环节
头像 佛系的青年
发表于 2025-03-15 11:41:17
主要是想通,这题的答案就是字符s去重后的长度,因为题目说的是可以无限制的添加任意字符 #include <iostream> #include <set> using namespace std; int main() { string s; cin &g 展开全文
头像 牛客研究僧
发表于 2025-03-05 15:07:56
print(len(set(input())))
头像 荔枝荔枝荔枝
发表于 2025-06-02 10:29:55
/** * 需要理解题目本质: * 循环 -> 重复 -> 节点再生 * 循环意味着会有重复的元素; * 所以只要有重复的元素,就可以以这个元素为据点,往其前后填充缺省的不重复的部分,形成一个循环节; * 就 展开全文
头像 扎男_
发表于 2025-04-04 18:32:40
活动地址: 牛客春招刷题训练营 - 编程打卡活动#include <iostream>#include<set>using namespace std;int main() {    string s;    cin>>s;    set<char>s 展开全文
头像 喜欢拱白菜的香菇想开了
发表于 2025-03-03 14:27:44
import java.util.*; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new S 展开全文
头像 永夏360
发表于 2025-05-17 16:36:45
#include <iostream> using namespace std; int main() { string str; while (cin >> str) { // 注意 while 处理多个 case int h[52]{0} 展开全文
头像 牛客856751393号
发表于 2025-03-04 16:56:42
字符串中不同字符的个数即为最小循环节。 while True: try: s = input() lst = [] for i in s: if i not in lst: lst.app 展开全文
头像 牛客928288679号
发表于 2025-04-04 22:57:13
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () = 展开全文
头像 喜欢耍游戏的小章鱼在走神
发表于 2025-05-18 00:46:04
s=input().strip() st=[] for i in s: if i not in st: st.append(i) print(len(st))
头像 bug克星a
发表于 2025-05-03 23:16:27
#include <iostream> #include<string> #include<unordered_set> #include <unordered_map> using namespace std; int main() { s 展开全文

等你来战

查看全部