fork download
  1.  
  2. import java.io.*;
  3. import java.util.*;
  4.  
  5. public class HowManyNumbers {
  6.  
  7. static PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
  8. static StringTokenizer st = new StringTokenizer("");
  9.  
  10. public static String next() {
  11. try {
  12. while (!st.hasMoreTokens()) {
  13. String s = br.readLine();
  14. if (s == null)
  15. return null;
  16. st = new StringTokenizer(s);
  17. }
  18. return st.nextToken();
  19. } catch(Exception e) {
  20. return null;
  21. }
  22. }
  23. public static void main(String[] asda) throws Exception {
  24. while (true) {
  25. int evens = Integer.parseInt( next() );
  26. int odds = Integer.parseInt( next() );
  27.  
  28. if (evens == 0 && odds == 0) {
  29. break;
  30. }
  31.  
  32. out.println( solve(1, evens, odds) );
  33. }
  34. //
  35. out.flush();
  36. System.exit(0);
  37. }
  38.  
  39. static long solve(int first, int evens, int odds) {
  40. if (evens == 0 && odds == 0) {
  41. return 2;
  42. }
  43. long ans = 0;
  44. if (evens != 0) {
  45. ans = (5L - first) * solve(0, evens - 1, odds);
  46. }
  47. if (odds != 0) {
  48. ans += 5L * solve(0, evens, odds - 1);
  49. }
  50.  
  51. if (first == 1 && evens == 1 && odds == 0) {
  52. ans++;
  53. }
  54. return ans;
  55. }
  56.  
  57. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:5: error: class HowManyNumbers is public, should be declared in a file named HowManyNumbers.java
public class HowManyNumbers {
       ^
1 error
stdout
Standard output is empty