Problem DescriptionGiven two sequences of numbers : a[1], a[2], ...... , a[N], and b[1], b[2], ...... , b[M] (1 <= M <= 10000, 1 <= N <= 1000000). Your task is to find a number K which make a[K] = b[1], a[K + 1] = b[2], ...... , a[K + M -
這兩題我都在之前做過,但並未通過,那次做的時候是剛開始接觸線段樹,現在有了一點點的瞭解,翻出以前的代碼稍作修改就AC了。之前1698錯誤的原因是沒有注意到位元運算的優先順序。//hdoj 1698#include<stdio.h>#include<string.h>#define maxn 100010struct node{ int l; int r; int mid; int
http://codeforces.com/problemset/problem/281/B這個題My Code是:#include<cstdio>#include<cmath>using namespace std;long long int gcd(long int a,long int b){ return a==0?b:gcd(b%a,a);}int main(){ long long int
A. Shaass and Oskols題意:在n條電線上有不同數量的鳥, Shaass開了m槍,每一槍打的是第xi條電線上的第yi只鳥,然後被打中的這隻鳥左邊的飛到第i-1條電線上,右邊的飛到i+1條電線上,沒有落腳點的鳥會飛走。#include <stdio.h>int a[105];int main(){ int n, m, x, y; while (scanf("%d",&n) != EOF) { for (int i = 1; i &
1015 Jury Compromise1029 False coin1036 Gangsters1037 A decorative fence1038 Bugs Integrated, Inc.1042 Gone Fishing1050 To the Max 解題報告1062 昂貴的聘禮1074 Parallel
題目連結題目描述很簡單 有n和DNA序列,求出他們中公用前置長度和有相同公用首碼DNA序列乘積的最大值。If we take the subset {ACGT} then the result is 4 (4 * 1), if we take {ACGT, ACGTGCGT, ACGCCGT} then the result is 3 * 3 = 9 (since ACG is the common prefix), if we take {ACGT, ACGTGCGT, ACCGTGC,