fork download
  1. class Main{
  2. static interface list{
  3. int get(int idx);
  4. int size();
  5. }
  6. static class range implements list {
  7. int begin;
  8. int end;
  9. range(int begin, int end){this.begin=begin; this.end=end;}
  10. public int get(int idx){return begin+idx;}
  11. public int size(){return end-begin;}
  12. }
  13. static class reverse implements list {
  14. list ls;
  15. reverse(list ls){this.ls=ls;}
  16. public int get(int idx){return ls.get(ls.size()-1-idx);}
  17. public int size(){return ls.size();}
  18. }
  19. public static void main (String[] args) throws java.lang.Exception {
  20. System.out.println( new reverse(new range(1,1000000001)).get(0) );
  21. }
  22. }
Success #stdin #stdout 0.08s 212416KB
stdin
Standard input is empty
stdout
1000000000