Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Added the two other test cases
Source Link
Bernat
  • 181
  • 1
  • 5

Java (OpenJDK 8), 91 bytes

i->{for(int j=0;j++<i;)for(int k=0,l=0;k++<j;)if((l+=j%k<1?k:0)>i)return k+","+l;return"";}

Try it online! Try it online! (timeout on third test case)

Java (OpenJDK 8), 91 bytes

i->{for(int j=0;j++<i;)for(int k=0,l=0;k++<j;)if((l+=j%k<1?k:0)>i)return k+","+l;return"";}

Try it online!

Java (OpenJDK 8), 91 bytes

i->{for(int j=0;j++<i;)for(int k=0,l=0;k++<j;)if((l+=j%k<1?k:0)>i)return k+","+l;return"";}

Try it online! (timeout on third test case)

Source Link
Bernat
  • 181
  • 1
  • 5

Java (OpenJDK 8), 91 bytes

i->{for(int j=0;j++<i;)for(int k=0,l=0;k++<j;)if((l+=j%k<1?k:0)>i)return k+","+l;return"";}

Try it online!

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