vector<bool> visit(100000,false); long long int a, b, m, x; cin >> a >> b >> m >> x; int total = 1; visit[x] = true; cout << x << ","; while (true) { x = (a*x + b) % m; if (visit[x]) { break; } visit[x] = true; total++; } cout << total << endl; 楼主我这个为什么只通过了64%,看了半天,就第一道全ac了😥
点赞 2

相关推荐

牛客网
牛客企业服务