public Program(string inputFile, string outputFile) { io = new IOHelper(inputFile, outputFile, Encoding.Default); m = io.NextInt(); d = io.NextInt(); string a = io.NextToken(), b = io.NextToken(); BigInteger tmp = BigInteger.Parse(a); tmp -= 1; a = tmp.ToString(); if (a.Length < b.Length) { a = "0" + a; } long ans = calc(b) - calc(a); ans %= mod; if (ans < 0) { ans += mod; } io.WriteLine(ans); io.Dispose(); }
public Program(string inputFile, string outputFile) { io = new IOHelper(inputFile, outputFile, Encoding.Default); sizeOfEach = new List <int>(); sizeOfEach.Add(0); n = io.NextInt(); m = io.NextInt(); k = io.NextInt(); map = new string[n]; foreach (int i in E.Range(0, n)) { map[i] = io.NextToken(); } vis = new int[n, m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (map[i][j] != '*' && vis[i, j] == 0) { sizeOfEach.Add(bfs(new Point(i, j))); } } } for (; k-- > 0;) { int xi = io.NextInt(); int yi = io.NextInt(); --xi; --yi; io.WriteLine(sizeOfEach[vis[xi, yi]]); } io.Dispose(); }
public Program(string inputFile, string outputFile) { io = new IOHelper(inputFile, outputFile, Encoding.Default); sizeOfEach = new List<int>(); sizeOfEach.Add(0); n = io.NextInt(); m = io.NextInt(); k = io.NextInt(); map = new string[n]; foreach (int i in E.Range(0, n)) { map[i] = io.NextToken(); } vis = new int[n, m]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (map[i][j]!='*'&&vis[i, j] == 0) { sizeOfEach.Add(bfs(new Point(i, j))); } } } for (; k-- > 0; ) { int xi = io.NextInt(); int yi = io.NextInt(); --xi; --yi; io.WriteLine(sizeOfEach[vis[xi, yi]]); } io.Dispose(); }
public Program(string inputFile, string outputFile) { io = new IOHelper(inputFile, outputFile, Encoding.Default); m = io.NextInt(); d = io.NextInt(); string a = io.NextToken(), b = io.NextToken(); BigInteger tmp = BigInteger.Parse(a); tmp -= 1; a = tmp.ToString(); if (a.Length < b.Length) a = "0" + a; long ans = calc(b) - calc(a); ans %= mod; if (ans < 0) ans += mod; io.WriteLine(ans); io.Dispose(); }