Skip to content

Instantly share code, notes, and snippets.

View henrybear327's full-sized avatar

Chun-Hung Tseng henrybear327

View GitHub Profile
@henrybear327
henrybear327 / w5b.c debug
Created April 7, 2015 01:59
w5b.c debug
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
long long int x[1000]= {0},m;
@henrybear327
henrybear327 / w3c(仲凱).c
Created March 22, 2015 10:37
w3c(仲凱).c
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
while (1) {
scanf("%d", &n);
if (n == 0)
break;
@henrybear327
henrybear327 / uva 10101.c
Created March 21, 2015 18:11
uva 10101.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void print_answer(long long int, int);
int main()
{
long long int input, count = 1;
while(scanf("%lld", &input) != EOF) {
@henrybear327
henrybear327 / uva 572.c
Created March 21, 2015 16:39
uva 572.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void checkforpockets(char [102][102], int, int, int, int);
int main()
{
int rows, columns;
while(scanf("%d %d", &rows, &columns) != EOF && rows != 0 && columns != 0) {
@henrybear327
henrybear327 / Project 2 basic version.c
Created March 20, 2015 13:22
Project 2 basic version.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
Write a program myadd such that user in command line type myadd n1 [n2] [n3]….
The program compute the sum of these number.
Basic requirement: the numbers are 32-bit integer
bonus: the numbers may have different types
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
//clang -lm w4a.c -o w4a
int compare(const void *a, const void *b)
{
return *(int *)a - *(int *)b;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int test_cases;
while(scanf("%d", &test_cases) != EOF) {
getchar();
while(test_cases--) {
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare(const void *a, const void *b)
{
return *(int *)a - *(int *)b;
}
int main()
@henrybear327
henrybear327 / uva 10035.c
Created March 19, 2015 13:58
uva 10035.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*
carry = add1%10 + add2%10 + carry;
carry /= 10;
add1 /= 10;
add2 /= 10;
if( carry )
@henrybear327
henrybear327 / uva 10929.c
Created March 19, 2015 13:12
uva 10929.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char input[1010];
while(fgets(input, 1010, stdin) && !(input[0] == '0' && input[1] == '\n')) { /*WTF, the '\n' is required!!*/
int i, len = strlen(input) - 1, sum_odd = 0, sum_even = 0;
input[len] = '\0';