This file contains hidden or 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
import SimpleHTTPServer | |
import SocketServer | |
import urlparse | |
PORT = 80 | |
class ServerHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): | |
def do_GET(self): | |
try: | |
query = urlparse.parse_qs(urlparse.urlparse(self.path).query) |
This file contains hidden or 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
/* File format: | |
* Number of couples | record for couple 1 | record for couple 2... | |
* int | No. | boy name | girl name | next pointer | ... | |
* | int | string | string | pointer | | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
This file contains hidden or 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
#include<stdio.h> | |
#include<math.h> | |
#define MAX 1000 | |
#define MAX_ITEMS 100 | |
int main() { | |
int i, j; | |
int n = 0, w[MAX_ITEMS+1] = {0}; | |
int s[MAX+1] = {1}; | |
float weight; | |
while (scanf("%f", &weight) != EOF) { |
This file contains hidden or 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
#include<stdio.h> | |
#include<math.h> | |
#define MAX 1000 | |
#define MAX_ITEMS 100 | |
int main() { | |
int i, j; | |
int n = 0, w[MAX_ITEMS+1] = {0}; | |
int s[MAX_ITEMS+1][MAX+1] = {1}; | |
float weight; | |
while (scanf("%f", &weight) != EOF) { |
This file contains hidden or 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
#!/bin/bash | |
# Usage: the first parameter should be the exported QQ message file | |
echo -e "Hour\tMyCnt\tMyLen\tMyAvglen\tHerCnt\tHerLen\tHer Avglen"; cat $1 | awk '/2014-/ { if($3=="boj") { split($2,time,":"); hour=time[1]; getline; me_len[hour]+=length($0); me_num[hour]++ } else { split($2,time,":"); hour=time[1]; getline; her_len[hour]+=length($0); her_num[hour]++ } } END {for(key in me_num) printf("%s\t%d\t%d\t%lf\t%d\t%d\t%lf\t\n", key, me_num[key], me_len[key], me_len[key] * 1.0 / me_num[key], her_num[key], her_len[key], her_len[key] * 1.0 / her_num[key] ) }' | sort -n | |
echo -e "Date\tMyCnt\tMyLen\tMyAvglen\tHerCnt\tHerLen\tHer Avglen"; cat $1 | awk '/2014-/ { if($3=="boj") { split($2,time,":"); hour=time[1]; getline; me_len[hour]+=length($0); me_num[hour]++ } else { split($2,time,":"); hour=time[1]; getline; her_len[hour]+=length($0); her_num[hour]++ } } END {for(key in me_num) printf("%s\t%d\t%d\t%lf\t%d\t%d\t%lf\t\n", key, me_num[key], me_len[key], me_len[key] * 1.0 / me_num[key], her_num[key], her_len[k |
This file contains hidden or 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
#include<stdio.h> | |
void c_p_mn_array(int m, int n, int result[2]) { | |
int i; | |
result[1] = 1; | |
for (i=m-n+1; i<=m; i++) | |
result[1] *= i; | |
result[0] = result[1]; | |
for (i=2; i<=n; i++) | |
result[0] /= i; | |
} |
This file contains hidden or 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
#include<stdio.h> | |
int main() { | |
double sign = 1, intpart = 0, decmod = 1; | |
int expsign = 1, exp = 0; | |
double ans; | |
int i; | |
char c; | |
c = getchar(); | |
if (c == '-') { |
This file contains hidden or 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
#include<stdio.h> | |
int ischar(char now) { | |
return (now >= 'a' && now <= 'z' || now >= 'A' && now <= 'Z'); | |
} | |
int main() | |
{ | |
char last = 0, now = 0; | |
int count = 0; | |
while ((now = getchar()) != EOF) { | |
if (ischar(now) && !ischar(last)) |
This file contains hidden or 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
#include<stdio.h> | |
static long get_factor_num(long n) { | |
int factor; | |
int exp_count = 1; | |
int ans = 1; | |
for (factor = 2; n > 1; factor++) { | |
exp_count = 1; | |
while (n % factor == 0) { | |
n /= factor; | |
exp_count *= factor; |
This file contains hidden or 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
#include<stdio.h> | |
#define N 15 | |
int main() { | |
int i, j, max = 0, state, total, pos; | |
int a[N][N]; | |
for (i=0; i<N; i++) | |
for (j=0; j<=i; j++) | |
scanf("%d", &a[i][j]); | |
for (state=0; state<(1<<(N-1)); state++) { | |
total = 0; |