fork(1) download
  1. public int minRounds(int a, int b, int c) {
  2. int ans = 0;
  3. while(b < c) {
  4. ++ans;
  5. b += b - a;
  6. }
  7. return ans;
  8. }
  9.  
  10.  
  11.  
  12. int getScore(int len) {
  13. return len * min(len, 26);
  14. }
  15. String getString(int len) {
  16. String s = "";
  17. for(int i = 0; i < len; ++i)
  18. s += (char) ('a' + i % 26);
  19. return s;
  20. }
  21. public String[] findAny(int K) {
  22. List<Integer> taken = new ArrayList<Integer>();
  23. while(K > 0) {
  24. int n = 1;
  25. while (getScore(n + 1) <= K && n + 1 <= 50)
  26. ++n;
  27. K -= getScore(n);
  28. taken.add(n);
  29. }
  30. String[] ans = new String[taken.size()];
  31. for(int i = 0; i < taken.size(); ++i)
  32. ans[i] = getString(taken.get(i));
  33. System.out.println(ans.length);
  34. return ans;
  35. }
  36.  
  37.  
  38.  
  39. final int mod = 1000 * 1000 * 1000 + 7;
  40. int add(int a, int b) { return (a + b) % mod; }
  41. int subtract(int a, int b) { return (a + mod - b) % mod; }
  42. int multiply(int a, int b) { return (int) ((long) a * b % mod); }
  43. int[][] outside;
  44. int GLOBAL_N;
  45. boolean ok(int i, int j) {
  46. return 0 <= i && i <= j && j < GLOBAL_N;
  47. }
  48. int f_outside(int i, int j) {
  49. return ok(i, j) ? outside[i][j] : 1;
  50. }
  51. public int solve(String s) {
  52. int n = s.length();
  53. GLOBAL_N = n;
  54. outside = new int[n][n];
  55. for (int i = 0; i < n; ++i)
  56. for (int j = n - 1; j > i; --j) {
  57. outside[i][j] = add(f_outside(i - 1, j), f_outside(i, j + 1));
  58. if (s.charAt(i) != s.charAt(j))
  59. outside[i][j] = subtract(outside[i][j], f_outside(i - 1, j + 1));
  60. }
  61.  
  62. int[] ans = new int[n];
  63. for (int i = 0; i < n; ++i)
  64. ans[i] = f_outside(i - 1, i + 1);
  65. write(ans);
  66. int X = 0;
  67. for(int i = 0; i < n; ++i)
  68. X ^= multiply(ans[i], i + 1);
  69. return X;
  70. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: class, interface, or enum expected
public int minRounds(int a, int b, int c) {
       ^
Main.java:3: error: class, interface, or enum expected
	while(b < c) {
	^
Main.java:5: error: class, interface, or enum expected
		b += b - a;
		^
Main.java:6: error: class, interface, or enum expected
	}
	^
Main.java:8: error: class, interface, or enum expected
}
^
Main.java:14: error: class, interface, or enum expected
}
^
Main.java:17: error: class, interface, or enum expected
	for(int i = 0; i < len; ++i)
	^
Main.java:17: error: class, interface, or enum expected
	for(int i = 0; i < len; ++i)
	               ^
Main.java:17: error: class, interface, or enum expected
	for(int i = 0; i < len; ++i)
	                        ^
Main.java:19: error: class, interface, or enum expected
	return s;
	^
Main.java:20: error: class, interface, or enum expected
}
^
Main.java:21: error: class, interface, or enum expected
public String[] findAny(int K) {
       ^
Main.java:23: error: class, interface, or enum expected
	while(K > 0) {
	^
Main.java:25: error: class, interface, or enum expected
		while (getScore(n + 1) <= K && n + 1 <= 50)
		^
Main.java:27: error: class, interface, or enum expected
		K -= getScore(n);
		^
Main.java:28: error: class, interface, or enum expected
		taken.add(n);
		^
Main.java:29: error: class, interface, or enum expected
	}
	^
Main.java:31: error: class, interface, or enum expected
	for(int i = 0; i < taken.size(); ++i)
	^
Main.java:31: error: class, interface, or enum expected
	for(int i = 0; i < taken.size(); ++i)
	               ^
Main.java:31: error: class, interface, or enum expected
	for(int i = 0; i < taken.size(); ++i)
	                                 ^
Main.java:33: error: class, interface, or enum expected
	System.out.println(ans.length);
	^
Main.java:34: error: class, interface, or enum expected
	return ans;
	^
Main.java:35: error: class, interface, or enum expected
}
^
Main.java:39: error: class, interface, or enum expected
final int mod = 1000 * 1000 * 1000 + 7;
      ^
Main.java:40: error: class, interface, or enum expected
int add(int a, int b) { return (a + b) % mod; }
^
Main.java:40: error: class, interface, or enum expected
int add(int a, int b) { return (a + b) % mod; }
                                              ^
Main.java:41: error: class, interface, or enum expected
int subtract(int a, int b) { return (a + mod - b) % mod; }
                                                         ^
Main.java:42: error: class, interface, or enum expected
int multiply(int a, int b) { return (int) ((long) a * b % mod); }
                                                                ^
Main.java:44: error: class, interface, or enum expected
int GLOBAL_N;
^
Main.java:45: error: class, interface, or enum expected
boolean ok(int i, int j) {
^
Main.java:47: error: class, interface, or enum expected
}
^
Main.java:50: error: class, interface, or enum expected
}
^
Main.java:51: error: class, interface, or enum expected
public int solve(String s) {
       ^
Main.java:53: error: class, interface, or enum expected
	GLOBAL_N = n;
	^
Main.java:54: error: class, interface, or enum expected
	outside = new int[n][n];
	^
Main.java:55: error: class, interface, or enum expected
	for (int i = 0; i < n; ++i)
	^
Main.java:55: error: class, interface, or enum expected
	for (int i = 0; i < n; ++i)
	                ^
Main.java:55: error: class, interface, or enum expected
	for (int i = 0; i < n; ++i)
	                       ^
Main.java:56: error: class, interface, or enum expected
		for (int j = n - 1; j > i; --j) {
		                    ^
Main.java:56: error: class, interface, or enum expected
		for (int j = n - 1; j > i; --j) {
		                           ^
Main.java:58: error: class, interface, or enum expected
			if (s.charAt(i) != s.charAt(j))
			^
Main.java:60: error: class, interface, or enum expected
		}
		^
Main.java:63: error: class, interface, or enum expected
	for (int i = 0; i < n; ++i)
	^
Main.java:63: error: class, interface, or enum expected
	for (int i = 0; i < n; ++i)
	                ^
Main.java:63: error: class, interface, or enum expected
	for (int i = 0; i < n; ++i)
	                       ^
Main.java:65: error: class, interface, or enum expected
	write(ans);
	^
Main.java:66: error: class, interface, or enum expected
	int X = 0;
	^
Main.java:67: error: class, interface, or enum expected
	for(int i = 0; i < n; ++i)
	^
Main.java:67: error: class, interface, or enum expected
	for(int i = 0; i < n; ++i)
	               ^
Main.java:67: error: class, interface, or enum expected
	for(int i = 0; i < n; ++i)
	                      ^
Main.java:69: error: class, interface, or enum expected
	return X;
	^
Main.java:70: error: class, interface, or enum expected
}
^
52 errors
stdout
Standard output is empty