Skip to content

Instantly share code, notes, and snippets.

View henrybear327's full-sized avatar

Chun-Hung Tseng henrybear327

View GitHub Profile
@henrybear327
henrybear327 / uva 10041.c
Created March 19, 2015 12:34
uva 10041.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int compare(const void *a, const void *b)
{
return *(int *)a - *(int *)b; /*positive, don't swap*/
}
int main()
@henrybear327
henrybear327 / uva 10055.c
Created March 19, 2015 12:34
uva 10055.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
long long int a, b;
while(scanf("%lld %lld", &a, &b) != EOF)
printf("%lld\n", (a - b) > 0 ? a - b : b - a);
@henrybear327
henrybear327 / uva 10035 wrong.c
Last active August 29, 2015 14:17
uva 10035 wrong.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 / C_AR38.c
Last active August 29, 2015 14:17
C_AR38
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int size;
scanf("%d", &size);
size++; //making the data stored and used in 1 ~ size format
@henrybear327
henrybear327 / w3a.c
Last active August 29, 2015 14:17
lance w3a.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZE 18
int power(int A,int p);
int main()
{
int cases;
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n;
while(scanf("%d",&n)!=EOF) {
long long int x,y,N,c;
while(n--) {
scanf("%lld %lld %lld",&x,&y,&N);
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void quicksort(int, int, int []);
int main()
{
int n;
while(scanf("%d", &n) != EOF && n) {
@henrybear327
henrybear327 / w3b.c
Last active August 29, 2015 14:17
w3b.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define RIGHT 1
#define LEFT -1
int main()
{
int total_cells, total_instructions;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
const int two_power[16] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768};
int main()
{
int test_cases;
while(scanf("%d", &test_cases) != EOF && test_cases) {
@henrybear327
henrybear327 / Test.c
Last active August 29, 2015 14:16
version 2 demo
Hello Stonie!!
This is version 2. You can see the difference in revision.