Skip to main content
Stack Overflow
  1. About
  2. For Teams
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Return to Answer

Commonmark migration
Source Link

##Java, (削除) 200 (削除ここまで)(削除) 192 (削除ここまで) 179 characters

Java, (削除) 200 (削除ここまで)(削除) 192 (削除ここまで) 179 characters

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare. It solves the trivial examples, but not the bonus one.

Here is the minimized version:

class F{public static void main(String[]a){long p=new Long(a[0]);for(int i=1;i<a.length;){long n=p*new Long(a[i++]),d=new Long(a[i++]);if(n%d<1){p=n/d;i=1;}}System.out.print(p);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

Here is the cleaned-up version:

public class Fractran {
 public static void main(String[] args) {
 long product = new Long(args[0]);
 for (int index = 1; index < args.length;) {
 long numerator = product * new Long(args[index++]);
 long denominator = new Long(args[index++]);
 if (numerator % denominator < 1) {
 product = numerator / denominator;
 index = 1;
 } // if
 } // for
 System.out.print(product);
 }
}

##Java, (削除) 200 (削除ここまで)(削除) 192 (削除ここまで) 179 characters

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare. It solves the trivial examples, but not the bonus one.

Here is the minimized version:

class F{public static void main(String[]a){long p=new Long(a[0]);for(int i=1;i<a.length;){long n=p*new Long(a[i++]),d=new Long(a[i++]);if(n%d<1){p=n/d;i=1;}}System.out.print(p);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

Here is the cleaned-up version:

public class Fractran {
 public static void main(String[] args) {
 long product = new Long(args[0]);
 for (int index = 1; index < args.length;) {
 long numerator = product * new Long(args[index++]);
 long denominator = new Long(args[index++]);
 if (numerator % denominator < 1) {
 product = numerator / denominator;
 index = 1;
 } // if
 } // for
 System.out.print(product);
 }
}

Java, (削除) 200 (削除ここまで)(削除) 192 (削除ここまで) 179 characters

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare. It solves the trivial examples, but not the bonus one.

Here is the minimized version:

class F{public static void main(String[]a){long p=new Long(a[0]);for(int i=1;i<a.length;){long n=p*new Long(a[i++]),d=new Long(a[i++]);if(n%d<1){p=n/d;i=1;}}System.out.print(p);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

Here is the cleaned-up version:

public class Fractran {
 public static void main(String[] args) {
 long product = new Long(args[0]);
 for (int index = 1; index < args.length;) {
 long numerator = product * new Long(args[index++]);
 long denominator = new Long(args[index++]);
 if (numerator % denominator < 1) {
 product = numerator / denominator;
 index = 1;
 } // if
 } // for
 System.out.print(product);
 }
}
Changed variable names in minimized version to be consistent with cleaned-up version.; deleted 2 characters in body
Source Link
shadit
  • 2.6k
  • 1
  • 16
  • 21

##Java, (削除) 200 (削除ここまで) (削除) 192 (削除ここまで) 180179 characters

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare. It solves the trivial examples, but not the bonus one.

Here is the minimized version:

class F{public static void main(String[]sString[]a){long n=newp=new Long(s[0]a[0]);for(int i=1;i<si=1;i<a.length;){long m=n*newn=p*new Long(s[i++]a[i++]),d=new Long(s[i++]a[i++]);if(m%d==0n%d<1){n=mp=n/d;i=1;}}System.out.print(np);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

Here is the cleaned-up version:

public class Fractran {
 public static void main(String[] args) {
 long product = new Long(args[0]);
 for (int index = 1; index < args.length;) {
 long numerator = product * new Long(args[index++]);
 long denominator = new Long(args[index++]);
 if (numerator % denominator ==< 01) {
 product = numerator / denominator;
 index = 1;
 } // if
 } // for
 System.out.print(product);
 }
}

##Java, (削除) 200 (削除ここまで) (削除) 192 (削除ここまで) 180 characters

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare. It solves the trivial examples, but not the bonus one.

Here is the minimized version:

class F{public static void main(String[]s){long n=new Long(s[0]);for(int i=1;i<s.length;){long m=n*new Long(s[i++]),d=new Long(s[i++]);if(m%d==0){n=m/d;i=1;}}System.out.print(n);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

Here is the cleaned-up version:

public class Fractran {
 public static void main(String[] args) {
 long product = new Long(args[0]);
 for (int index = 1; index < args.length;) {
 long numerator = product * new Long(args[index++]);
 long denominator = new Long(args[index++]);
 if (numerator % denominator == 0) {
 product = numerator / denominator;
 index = 1;
 } // if
 } // for
 System.out.print(product);
 }
}

##Java, (削除) 200 (削除ここまで) (削除) 192 (削除ここまで) 179 characters

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare. It solves the trivial examples, but not the bonus one.

Here is the minimized version:

class F{public static void main(String[]a){long p=new Long(a[0]);for(int i=1;i<a.length;){long n=p*new Long(a[i++]),d=new Long(a[i++]);if(n%d<1){p=n/d;i=1;}}System.out.print(p);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

Here is the cleaned-up version:

public class Fractran {
 public static void main(String[] args) {
 long product = new Long(args[0]);
 for (int index = 1; index < args.length;) {
 long numerator = product * new Long(args[index++]);
 long denominator = new Long(args[index++]);
 if (numerator % denominator < 1) {
 product = numerator / denominator;
 index = 1;
 } // if
 } // for
 System.out.print(product);
 }
}
Added cleaned up version, labeled things.; added 52 characters in body; added 4 characters in body
Source Link
shadit
  • 2.6k
  • 1
  • 16
  • 21

##Java, (削除) 200 (削除ここまで) (削除) 192 (削除ここまで) 180 characters

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare. It solves the trivial examples, but not the bonus one.

Here is the minimized version:

class F{public static void main(String[]s){long n=new Long(s[0]);for(int i=1;i<s.length;){long m=n*new Long(s[i++]),d=new Long(s[i++]);if(m%d==0){n=m/d;i=1;}}System.out.print(n);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

I think everyone knows that Java would not haveHere is the shortest implementation, but I wanted to see how it would compare.cleaned-up version:

public class Fractran {
 public static void main(String[] args) {
 long product = new Long(args[0]);
 for (int index = 1; index < args.length;) {
 long numerator = product * new Long(args[index++]);
 long denominator = new Long(args[index++]);
 if (numerator % denominator == 0) {
 product = numerator / denominator;
 index = 1;
 } // if
 } // for
 System.out.print(product);
 }
}

##Java, (削除) 200 (削除ここまで) (削除) 192 (削除ここまで) 180 characters

class F{public static void main(String[]s){long n=new Long(s[0]);for(int i=1;i<s.length;){long m=n*new Long(s[i++]),d=new Long(s[i++]);if(m%d==0){n=m/d;i=1;}}System.out.print(n);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare.

##Java, (削除) 200 (削除ここまで) (削除) 192 (削除ここまで) 180 characters

I think everyone knows that Java would not have the shortest implementation, but I wanted to see how it would compare. It solves the trivial examples, but not the bonus one.

Here is the minimized version:

class F{public static void main(String[]s){long n=new Long(s[0]);for(int i=1;i<s.length;){long m=n*new Long(s[i++]),d=new Long(s[i++]);if(m%d==0){n=m/d;i=1;}}System.out.print(n);}}

java -cp . F 108 455 33 11 13 1 11 3 7 11 2 1 3

15625

java -cp . F 1296 3 2

6561

Here is the cleaned-up version:

public class Fractran {
 public static void main(String[] args) {
 long product = new Long(args[0]);
 for (int index = 1; index < args.length;) {
 long numerator = product * new Long(args[index++]);
 long denominator = new Long(args[index++]);
 if (numerator % denominator == 0) {
 product = numerator / denominator;
 index = 1;
 } // if
 } // for
 System.out.print(product);
 }
}
deleted 3 characters in body; deleted 9 characters in body
Source Link
shadit
  • 2.6k
  • 1
  • 16
  • 21
Loading
deleted 3 characters in body
Source Link
shadit
  • 2.6k
  • 1
  • 16
  • 21
Loading
added 17 characters in body
Source Link
shadit
  • 2.6k
  • 1
  • 16
  • 21
Loading
added 120 characters in body
Source Link
shadit
  • 2.6k
  • 1
  • 16
  • 21
Loading
Post Made Community Wiki
Source Link
shadit
  • 2.6k
  • 1
  • 16
  • 21
Loading

AltStyle によって変換されたページ (->オリジナル) /