📄 flavius.java
字号:
import java.io.*;import java.util.*;public class flavius { public static void main(String [] args) throws Exception { int n; Scanner in = new Scanner(new File("flavius.in")); while((n = in.nextInt()) != 0) { int a = in.nextInt(); int b = in.nextInt(); long x = 0; HashMap<Integer,Integer> visit = new HashMap<Integer,Integer>(); int c = 0; while(true) { ++c; if (visit.get((int)x) != null) { int t = visit.get((int)x); System.out.println(n-(c-t)); break; } visit.put((int)x,c); x = ((((x*x)%n)*a)%n+b)%n; } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -