Skip to content

Instantly share code, notes, and snippets.

View Abreto's full-sized avatar
🔋
Charging

Abreto Abreto

🔋
Charging
View GitHub Profile
@Abreto
Abreto / gist:3871850
Created October 11, 2012 11:55
PKU 1656 - Counting Black
/* PKU 1656 - Counting Black. */
#include <stdio.h>
#include <string.h>
int main(void)
{
int i = 0, m = 0;
int t = 0;
char command[6] = " ";
int x = 0, y = 0, L = 0;
@Abreto
Abreto / graph.c
Created October 20, 2012 06:19
数据结构{Data_Structure}
/** Graph in C. Abreto<m@abreto.net>. 未完成. */
#include <stdlib.h>
#include <limits.h>
const size_t default_vertices = 30; // 默认最大顶点数
typedef struct // 结点数据类型
{
int data;
}gmtx_vertices;
@Abreto
Abreto / day1-carpet.c
Created October 20, 2012 15:33
NOIP2011提高组
/* NOIP2011 Day1 - carpet.c */
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i = 0, j = 0;
int n = 0;
int *a = NULL, *b = NULL, *g = NULL, *k = NULL;
int x = 0, y = 0;
@Abreto
Abreto / approximation.c
Created October 24, 2012 05:17
白书第二章上机练习
/* Chapter 02 - approximation */
#include <stdio.h>
int main(void)
{
int i = 0;
double pi_4 = 0.0, t = 0.0;
i = 1;
while( (t=1.0/(2*i-1)) >= 0.000001 )
@Abreto
Abreto / gist:3994267
Created November 1, 2012 15:19
UVaOJ 568 - Just the Facts
/* UVaOJ 568 - Just the Facts */
#include <stdio.h>
int main(void)
{
int N = 0;
while( scanf("%d", &N)==1 )
{
int i = 0;
@Abreto
Abreto / gist:3994439
Created November 1, 2012 15:40
递归生成1~n的排列
void swap(int *a, int *b)
{
int t = *a;
*a = *b;
*b = t;
}
void permutation(int *S, int start, int end, int *A, int cur)
{
int i = 0;
if(start == end) // 递归边界
@Abreto
Abreto / gist:4016631
Created November 5, 2012 10:59
UVaOJ 10167 - Birthday Cake
/* UVaOJ 10167 - Birthday Cake */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int is_available(int a, int b);
int N = 0;
int x[100]={0}, y[100]={0};
@Abreto
Abreto / vigenere.c
Created November 12, 2012 07:56
NOIP2012 Day1 - vigenere
/* NOIP2012 Day1 - Vigenere */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define Rni(ci, ki) ( (ci)-(ki)+((ci)<(ki)?(26):0) )
char M[100];
char K[100];
char C[100];
@Abreto
Abreto / gist:4434182
Created January 2, 2013 12:18
UVa 490 - Rotating Sentences.
/* UVa 490 - Rotating Sentences. */
#include <stdio.h>
#include <string.h>
int main()
{
int i = 0, j = 0;
int N = 0;
char sentences[100][100];
int length[100] = {0};
@Abreto
Abreto / gist:4683254
Last active December 12, 2015 00:19
编程啦-Problem-1268
/* Bianchengla - Problem 1268. */
#include <stdio.h>
int count(int distance);
int count_val[40] = {0};
int main()
{
int N = 0;
int start = 0, end = 0;