Skip to content

Instantly share code, notes, and snippets.

#include <cstdio>
using namespace std;
int N,M,Q,L,U;
int H[501][501];
int BS_1 (int i) // 二分搜尋找出每列的符合>=L的最小值
{
int left = 0, right = M-1, mid;
while (left != right){
#include <cstdio>
using namespace std;
int main()
{
int T,N,P,h[101]; // T: number of cases, N: number of days
// P: number of parties, h[i]: hartal parameter for party i
scanf("%d",&T);
while (T--)
{
#include <cstdio>
using namespace std;
struct fraction{
int M; //Molecular 分子
int D; //Denominator 分母
};
int main()
{
int m,n;
while (scanf("%d%d",&m,&n))
#include <cstdio>
using namespace std;
int n,m;
char field[105][105];
void Fill (int x,int y)
{
for (int i=-1; i<=1; i++)
for (int j=-1; j<=1; j++)
#include <cstdio>
using namespace std;
int main()
{
int T,Case=1;
scanf("%d",&T);
getchar();
while (T--){
int N[1001],nOfN=0; //用來存非3的倍數的數字
int nOf3x = 0; //該位數為3的倍數的個數
#include <cstdio>
#include <algorithm>
using namespace std;
struct dictionary{
char w[10];
int map;
}dic[102];
bool cmp (dictionary a,dictionary b){
for (int i=0; ; i++)
if (a.w[i] != b.w[i]) return a.w[i] < b.w[i];
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
// freopen("input.txt","rt",stdin);
int Case,N,P[1001],i;
scanf("%d",&Case);
while (Case--)
{
#include <cstdio>
#include <algorithm>
using namespace std;
int N,R,C,area[101][101];
char name[100];
// 定義find_longest函數為回傳該點(area[i][j])盡可能走的最遠長度
int find_longest (int i,int j,int length) // length為目前已經走的長度
{
int a=0, b=0, c=0, d=0;
#include <cstdio>
using namespace std;
typedef long long int llt;
llt H (int m,int n){
m = (m+n-1);
if (n > m/2) n = (m-n);
int M[100],N[100],i,j;
for (i=0; i<n; i++){
M[i] = m - i;
#include <cstdio>
using namespace std;
int fib[1001][501]={0};
int main()
{
fib[0][0]=1;
fib[1][0]=2;
for (int i=2; i<=1000; i++){
for (int j=0; j<500; j++){