Skip to content

Instantly share code, notes, and snippets.

View henrybear327's full-sized avatar

Chun-Hung Tseng henrybear327

View GitHub Profile
@henrybear327
henrybear327 / ACM10409(with algorithm written on the notebook paper).c
Last active August 29, 2015 14:07
ACM10409(with algorithm written on the notebook paper).c
#include <stdio.h>
#include <stdlib.h>
/*
http://uva.onlinejudge.org/index.php?option=onlinejudge&Itemid=99999999&page=show_problem&category=&problem=1350&mosmsg=Submission+received+with+ID+14394659
*/
/*
Debugging experience...
If the answer appears to be right all the time, check the ENTIRE algorithm again. Two hours were spent on debugging a trivial typo bug in the code...
*/
@henrybear327
henrybear327 / ACM10409(陳冠儒).c
Created October 24, 2014 15:35
ACM10409(陳冠儒).c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int n,north,west,east,south,top,bottom,tempbottom,temptop;
char side[10];
while(scanf("%d",&n)==1 && n!=0)
{
top=1;
@henrybear327
henrybear327 / ACM100(new printf method).c
Last active August 29, 2015 14:08
ACM100(new printf method).c
/*
READ THE QUESTIONS CAREFULLY!
EVERY WORD REGARDING ALGORITHM, INPUT, OUTPUT, ETC. MUST BE CAREFULLY READ AND FOLLOWED.
eg. Think of swapping the input; be cautious on the output format!!!
What the statements said in the questions count, not my personal judgement!
The f****** "output order must be the same as input" statement caught me off guard TWICE! Learn the lesson.
*/
#include <stdio.h>
#include <stdlib.h>
@henrybear327
henrybear327 / ACM100(self-test program for 宗穎's code).c
Last active August 29, 2015 14:08
ACM100(self-test program for 宗穎's code).c
/*
READ THE QUESTIONS CAREFULLY!
EVERY WORD REGARDING ALGORITHM, INPUT, OUTPUT, ETC. MUST BE CAREFULLY READ AND FOLLOWED.
eg. Think of swapping the input; be cautious on the output format!!!
What the statements said in the questions count, not my personal judgement!
The f****** "output order must be the same as input" statement caught me off guard TWICE! Learn the lesson.
*/
#include <stdio.h>
#include <stdlib.h>
@henrybear327
henrybear327 / UVA10409(宗穎).c
Created October 26, 2014 12:30
UVA10409(宗穎).c
#include<stdio.h>
#include<string.h>
struct Die
{
int top, bottom, north, east, south, west;
};
struct Die d;
int main()
{
int n;
@henrybear327
henrybear327 / ACM10409(using define).c
Created October 26, 2014 13:46
ACM10409(using define).c
#include <stdio.h>
#include <stdlib.h>
#define north 2
#define south 3
#define east 0
#define west 1
#define top 4
#define bottom 5
/*
@henrybear327
henrybear327 / ACM10409(宋培萱).c
Created October 26, 2014 16:49
ACM10409(宋培萱).c
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,i,a,up,down,north,south,east,west,fnorth,fsouth,feast,fwest,fup,fdown;
char k[10];
char j[10]="north";
char j1[10]="east";
char j2[10]="south";
@henrybear327
henrybear327 / ACM100(黃鈺程神ans).c
Created October 26, 2014 18:06
ACM100(黃鈺程神ans).c
#include <stdio.h>
#include <stdlib.h>
int max(const int a, const int b) {
return ((a > b) ? a : b);
}
int min(const int a, const int b) {
return ((a < b) ? a : b);
}
@henrybear327
henrybear327 / ACM10038.c
Created October 27, 2014 09:20
ACM10038.c
#include <stdio.h>
#include <stdlib.h>
/*
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=&problem=979&mosmsg=Submission+received+with+ID+14429995
*/
int main()
{
int total_cases;
while(scanf("%d", &total_cases)!= EOF)
@henrybear327
henrybear327 / ACM10038(using cleaner method).c
Last active August 29, 2015 14:08
ACM10038(using cleaner method).c
#include <stdio.h>
#include <stdlib.h>
/*
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=&problem=979&mosmsg=Submission+received+with+ID+14429995
*/
/*
check corner case, such as 2 1 1...
*/
int main()