fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. long long i,n,s[100003],a=0,g;
  4. int main()
  5. {
  6. cin>>n;
  7. for (i=0;i<n;i++) cin>>s[i];
  8. sort(s,s+n);
  9. for (i=0;i<n;i++) a+=s[i]*(i*4-2*n+3);
  10. g=__gcd(a,n);
  11. cout<<a/g<<" "<<n/g;
  12. return 0;
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: illegal character: '#'
#include<bits/stdc++.h>
^
Main.java:1: error: class, interface, or enum expected
#include<bits/stdc++.h>
        ^
Main.java:3: error: class, interface, or enum expected
long long i,n,s[100003],a=0,g;
^
Main.java:4: error: class, interface, or enum expected
int main()
^
Main.java:7: error: class, interface, or enum expected
    for (i=0;i<n;i++) cin>>s[i];
    ^
Main.java:7: error: class, interface, or enum expected
    for (i=0;i<n;i++) cin>>s[i];
             ^
Main.java:7: error: class, interface, or enum expected
    for (i=0;i<n;i++) cin>>s[i];
                 ^
Main.java:8: error: class, interface, or enum expected
    sort(s,s+n);
    ^
Main.java:9: error: class, interface, or enum expected
    for (i=0;i<n;i++)   a+=s[i]*(i*4-2*n+3);
    ^
Main.java:9: error: class, interface, or enum expected
    for (i=0;i<n;i++)   a+=s[i]*(i*4-2*n+3);
             ^
Main.java:9: error: class, interface, or enum expected
    for (i=0;i<n;i++)   a+=s[i]*(i*4-2*n+3);
                 ^
Main.java:10: error: class, interface, or enum expected
    g=__gcd(a,n);
    ^
Main.java:11: error: class, interface, or enum expected
    cout<<a/g<<" "<<n/g;
    ^
Main.java:12: error: class, interface, or enum expected
    return 0;
    ^
Main.java:13: error: class, interface, or enum expected
}
^
15 errors
stdout
Standard output is empty