« first day (2833 days earlier)      last day (1269 days later) » 

12:00 AM
I don't do it for the money. -- Donald Trump, Art of the Deal (source)
 
 
7 hours later…
Zoe
6:50 AM
1 message moved from Java
 
 
3 hours later…
 
5 hours later…
 
2 hours later…
4:43 PM
import java.io.*;
import java.util.*;

public class Solution {
static int x, y;

// Function to implement the extended
// euclid algorithm
static int gcd_extend(int a, int b)
{

// Base Case
if (b == 0)
{
x = 1;
y = 0;
return a;
}

// Recursively find the gcd
else
{
int g = gcd_extend(b, a % b);
int x1 = x, y1 = y;
x = y1;
y = x1 - (a / b) * y1;
return g;
}
}

// Function to print the solutions of
// the given equations ax + by = c
static void print_solution(int a, int b, int c)
{
if (a == 0 && b == 0)
using bruteforce approach import java.io.*;
import java.util.*;

public class Solution {

public static void main(String[] args) {
Scanner s = new Scanner(System.in);
long a = s.nextLong();
long b = s.nextLong();
//au+bv=1
for(int u = 1; ; u++){
long v = (1 - a*u) / b;
if(a*u + b*v == 1){
System.out.println(u + " " + v);
break;
}
long vs = (1 - a*-u) / b;
if(a*-u + b*vs == 1){
System.out.println("-" + u + " " + vs);
break;
}
}
s.close();
}
}
 
Zoe
2 messages moved from Java
 
 
4 hours later…
9:12 PM
Hi everyone,
I am playing a little with inheritance, chaining and method binding and I am kind of stuck trying to achieve the following:
```
foo = Chain("h")
bar = foo("e")("l")("l")("o")

foo.toString() == "h"
bar.toString() == "hello"
bar.ancestor.toString() == "hell"
```

I have made it to create a method chaining but not quite what I want with the following code, any thoughts or guidance would be apreciated.

```
function ChainParent() {
}
function Chain(letter) {
this.letter = letter;
 
1 message moved from JavaScript
 

« first day (2833 days earlier)      last day (1269 days later) »