Skip to content

Instantly share code, notes, and snippets.

View pinglunliao's full-sized avatar

pinglunliao pinglunliao

View GitHub Profile
@pinglunliao
pinglunliao / d709.cpp
Last active November 5, 2019 08:56
d709: 判断质数(一). FYI: https://yunlinsong.blogspot.com/2015/03/d709.html
#include <stdio.h>
#include <cmath>
using namespace std;
const int limitValue = 1000000;
//const int num = 78498;
const int num = 78500;
@pinglunliao
pinglunliao / a227.cpp
Last active November 5, 2019 08:55
a227: 三龍杯 -> 河內之塔. FYI: https://yunlinsong.blogspot.com/2015/03/a227.html
#include <cstdio>
using namespace std;
void hanoi(int i, char a, char b, char c)
{
if(i == 1)
{
printf("Move ring %d from %c to %c\n", i, a, c);
}
#include <iostream>
#include <string>
// Fibonacci
using namespace std;
string addition(string s, string s2) // 加法
{
int len, lenS, MaxL, i, a, b, c = 0;
string BNstr(s2);
#include<stdio.h>
// val 存結果。p 紀錄階乘結果。psize 紀錄算到多少階乘。
int val[1001], p[10000], psize = 0;
int main(){
int i, j, n;
p[0] = 1;
val[0] = 1;
for(i = 1; i <= 1000; i++){
#include <iostream>
using namespace std;
int get_cycle_length(int num);
int main(void)
{
int i, j, k, start, end;
int maximum = 1;
#include <iostream>
#include <iomanip>
using namespace std;
/*
15 28 6 56 60000 22 496 0
15 DEFICIENT
#include <iostream>
using namespace std;
void prtTriangle(short a, int f)
{
short start = -a + 1;
short end = a - 1;
for( int times = 0; times < f - 1; times++ )
{
#include <iostream>
using namespace std;
int main(void)
{
char ch;
int count = 1;
while( cin.get(ch) )
{
#include <iostream>
using namespace std;
long f91(int n)
{
if( n >= 101 )
return n - 10;
else
return 91;
#include <iostream>
using namespace std;
int main()
{
long long int a, b, d;
while( cin >> a >> b )
{
d = a - b;