public class BearDarts {
int gcd( int a, int b) {
return a > 0 ? gcd( b% a,a) : b;
}
Long hash
( int a,
int b
) { int g = gcd( a, b) ;
return a/ g * 1000L * 1000 * 1001 + b/ g;
}
void add( int a, int b) {
if ( now == null ) now = 0 ;
m.put ( x, now + 1 ) ;
}
int cnt( int a, int b) {
if ( now == null ) return 0 ;
return now;
}
public long count( int [ ] scores) {
int n = scores.length ;
long result = 0 ;
for ( int i = 0 ; i < n; ++ i) {
int c = scores[ i] ;
for ( int j = i + 1 ; j < n; ++ j) {
int d = scores[ j] ;
result += cnt( d, c) ;
}
int b = scores[ i] ;
for ( int j = 0 ; j < i; ++ j) {
int a = scores[ j] ;
add( a, b) ;
}
}
return result;
}
}
cHVibGljIGNsYXNzIEJlYXJEYXJ0cyB7CiAgICBpbnQgZ2NkKGludCBhLCBpbnQgYikgewogICAgICAgIHJldHVybiBhID4gMCA/IGdjZChiJWEsYSkgOiBiOwogICAgfQogICAgTG9uZyBoYXNoKGludCBhLCBpbnQgYikgewogICAgICAgIGludCBnID0gZ2NkKGEsIGIpOwogICAgICAgIHJldHVybiBhL2cgKiAxMDAwTCAqIDEwMDAgKiAxMDAxICsgYi9nOwogICAgfQogICAgVHJlZU1hcDxMb25nLEludGVnZXI+IG0gPSBuZXcgVHJlZU1hcCgpOwogICAgdm9pZCBhZGQoaW50IGEsIGludCBiKSB7CiAgICAgICAgTG9uZyB4ID0gaGFzaChhLCBiKTsKICAgICAgICBJbnRlZ2VyIG5vdyA9IG0uZ2V0KHgpOwogICAgICAgIGlmKG5vdyA9PSBudWxsKSBub3cgPSAwOwogICAgICAgIG0ucHV0KHgsIG5vdyArIDEpOwogICAgfQogICAgaW50IGNudChpbnQgYSwgaW50IGIpIHsKICAgICAgICBMb25nIHggPSBoYXNoKGEsIGIpOwogICAgICAgIEludGVnZXIgbm93ID0gbS5nZXQoeCk7CiAgICAgICAgaWYobm93ID09IG51bGwpIHJldHVybiAwOwogICAgICAgIHJldHVybiBub3c7CiAgICB9CiAgICBwdWJsaWMgbG9uZyBjb3VudChpbnRbXSBzY29yZXMpIHsKICAgICAgICBpbnQgbiA9IHNjb3Jlcy5sZW5ndGg7CiAgICAgICAgbG9uZyByZXN1bHQgPSAwOwogICAgICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKICAgICAgICAgICAgaW50IGMgPSBzY29yZXNbaV07CiAgICAgICAgICAgIGZvcihpbnQgaiA9IGkgKyAxOyBqIDwgbjsgKytqKSB7CiAgICAgICAgICAgICAgICBpbnQgZCA9IHNjb3Jlc1tqXTsKICAgICAgICAgICAgICAgIHJlc3VsdCArPSBjbnQoZCwgYyk7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgaW50IGIgPSBzY29yZXNbaV07CiAgICAgICAgICAgIGZvcihpbnQgaiA9IDA7IGogPCBpOyArK2opIHsKICAgICAgICAgICAgICAgIGludCBhID0gc2NvcmVzW2pdOwogICAgICAgICAgICAgICAgYWRkKGEsIGIpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHJldHVybiByZXN1bHQ7CiAgICB9Cn0K
compilation info
Main.java:1: error: class BearDarts is public, should be declared in a file named BearDarts.java
public class BearDarts {
^
Main.java:9: error: cannot find symbol
TreeMap<Long,Integer> m = new TreeMap();
^
symbol: class TreeMap
location: class BearDarts
Main.java:9: error: cannot find symbol
TreeMap<Long,Integer> m = new TreeMap();
^
symbol: class TreeMap
location: class BearDarts
3 errors
stdout