Skip to content

Instantly share code, notes, and snippets.

View Abreto's full-sized avatar
🔋
Charging

Abreto Fu Abreto

🔋
Charging
View GitHub Profile
@Abreto
Abreto / gist:5450950
Last active December 16, 2015 14:49
PC110203 - UVa10050
/* PC 110203 - Hartals */
#include <stdio.h>
int main(void)
{
int T = 0;
scanf("%d", &T);
while (T--)
{
@Abreto
Abreto / eculid.py
Last active December 13, 2015 18:18
欧几里得算法
# Euclid Algorithm
def gcd(m, n):
while n != 0:
t = m
m = n
n = t % n
return m
#
@Abreto
Abreto / gist:4700958
Created February 3, 2013 08:37
UVa 488 - Triangle Wave.
/* UVa 488 - Triangle Wave. */
#include <stdio.h>
int main()
{
int i = 0, j = 0, k = 0;
int T = 0;
int A = 0, F = 0;
int fcount = 0;
int h = 0;
@Abreto
Abreto / gist:4700774
Created February 3, 2013 06:47
UVa - 445 - Marvelous Mazes.
/* UVa OJ. 445 - Marvelous Mazes. */
#include <stdio.h>
#include <string.h>
int main()
{
int i = 0, j = 0;
char line[150], out;
int sum;
@Abreto
Abreto / main.c
Last active December 12, 2015 00:28
编程啦-Problem-1204
/* Bianchengla - Problem 1204. */
#include <stdio.h>
long long int C[20][20] = {
{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20},
{0,1,3,6,10,15,21,28,36,45,55,66,78,91,105,120,136,153,171,190},
{0,0,1,4,10,20,35,56,84,120,165,220,286,364,455,560,680,816,969,1140},
{0,0,0,1,5,15,35,70,126,210,330,495,715,1001,1365,1820,2380,3060,3876,4845},
{0,0,0,0,1,6,21,56,126,252,462,792,1287,2002,3003,4368,6188,8568,11628,15504},
{0,0,0,0,0,1,7,28,84,210,462,924,1716,3003,5005,8008,12376,18564,27132,38760},
@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;
@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 / 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: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 / 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) // 递归边界