Skip to content

Instantly share code, notes, and snippets.

@WindAzure
WindAzure / 2_variable_swap.cpp
Last active August 4, 2018 16:12
algorithm exercise
#include <stdio.h>
int main()
{
int a = 3;
int b = 2;
a = a - b;
b = b + a;
a = b - a;
@WindAzure
WindAzure / 3_variable_swap.cpp
Last active August 4, 2018 17:40
algorithm exercise
#include <stdio.h>
#include <algorithm>
using namespace std;
int main()
{
int a, b, c;
while (~scanf("%d%d%d", &a, &b, &c))
{
@WindAzure
WindAzure / factorial_summation.cpp
Last active August 6, 2018 16:10
algorithm exercise
#include <stdio.h>
int main()
{
auto n = 0;
const auto modNum = 1000000;
while (~scanf("%d", &n))
{
n = n >= 25 ? 25 : n;
@WindAzure
WindAzure / specify_decimal_digits_precise.cpp
Last active August 26, 2018 05:07
algorithm exercise
#include <stdio.h>
#include <math.h>
int main()
{
auto T = 1;
auto a = 0, b = 0, c = 0;
while (~scanf("%d%d%d", &a, &b, &c))
{
if (a == 0 && b == 0 && c == 0) break;
#include <stdio.h>
#include <math.h>
int main()
{
auto T = 1;
auto a = 0, b = 0, c = 0;
while (~scanf("%d%d%d", &a, &b, &c))
{
if (a == 0 && b == 0 && c == 0) break;
@WindAzure
WindAzure / reciprocal_square_summation.cpp
Last active August 26, 2018 05:08
algorithm exercise
#include <stdio.h>
int main()
{
auto T = 1;
auto n = 0, m = 0;
while (~scanf("%d%d", &n, &m))
{
if (n == 0 && m == 0)
{
@WindAzure
WindAzure / hanxin.cpp
Last active August 26, 2018 05:08
algorithm exercise
#include <stdio.h>
#define TABLE_LENGTH 3 * 5 + 1
int table[3][TABLE_LENGTH] = {
{ 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0 },
{ 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0 },
{ 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0, 1 }
};
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sstream>
#include <iostream>
#include <vector>
#define MAX_A_DIGIT 10
#define MAX_A_DIGIT_POWER_2 1024
#define TOLERANCE 0.00001
@WindAzure
WindAzure / Kickdown.cpp
Last active September 16, 2018 16:23
Uva 1588
#include <stdio.h>
#include <string.h>
#include <algorithm>
auto masterLen = 0, drivenLen = 0;
int masterSection[101], drivenSection[101];
bool IsDriftingDrivenSectionMatchMasterSection(int offset)
{
for (auto i = 0; i < drivenLen; i++)
@WindAzure
WindAzure / Find the Border.cpp
Last active September 16, 2018 16:24
UVa 10340
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
char s[1000], t;
while (~scanf("%s", s))