This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Singleton { | |
private static Singleton instance = null; | |
private Singleton() { | |
//dosomething | |
} | |
public static synchronized Singleton getInstance() { | |
if(instance == null) { | |
instance = new Singleton(); | |
} | |
return instance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int Isort(int a[], int s, int e) { | |
int i, j, t; | |
for(i=s+1; i <= e; i++) { | |
t = a[i]; | |
for(j = i-1; j>=s && a[j]>t; j--) | |
a[j+1] = a[j]; | |
a[j+1] = t; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Qsort(int a[], int s, int e) { | |
if(s>=e) return; | |
int p=s, q=e, t; | |
int k = getPivot(a,s,e); | |
t = a[k]; | |
a[k] = a[s]; | |
while(p<q) { | |
while(p<q&&a[q]>=t) q--; | |
a[p] = a[q]; | |
while(p<q&&a[p]<=t) p++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
M[16],X=16,W,k; | |
main() { | |
T(system("stty cbreak")); | |
puts(W&1 ? "WIN":"LOSE"); | |
} | |
K[]={2,3,1}; | |
s(f,d,i,j,l,P) { | |
for(i=4; i--; ) | |
for(j=k=l=0; k<4; ) |
NewerOlder