摘要:#include #include using namespace std; int n,k; char s[100000+10]; int a[100000+10]; int f(char c){ a[0]=0;int ans=-1; for(int i=0;ik) j++; ans = max(ans,i-j); } return ans;...
阅读全文
摘要:#include #include #include using namespace std; double a[15][15]; int vis[15][15]; int ans; int N,M; void f(int n,int m,double t,double v){ if(!t) return; else{ double rt = (20-a...
阅读全文
摘要:题目给出1~n的n个数的一个permutation,swap一次任意两个数,output 1 and n 之间的最大距离 记录1 and n的位置p,确定1的位置,移动n到位置1 and n,确定n的位置,移动1到位置1 and n,output max value. O(n).
阅读全文
摘要:///Nearest Common Ancestors /// 1330 #include #include #include #include using namespace std; const int maxn = 10000+10; int t,n; vector v[maxn],Q[maxn]; int p[maxn]; int ind[maxn]; int ancester[...
阅读全文
摘要:#include #include #include #include #include const int INF=0x3f3f3f3f; using namespace std; const int M=110; int n,m; vector v[M]; int G[M][M]; struct Node { int u,v; int w; }; Node node...
阅读全文
摘要:#include #include using namespace std; int gcd(int a,int b) { return b?gcd(b,a%b):a; } int n[100+10]; int main() { int t,maxn = 0; scanf("%d",&t); for(int i=0; i<t; i++) { ...
阅读全文
摘要:那天下午警报的解除信号已经响过了。华南一个大城市的一条热闹马路上排满了两行人,都在肃立着,望着那预备保卫国土的壮丁队伍游行。 队伍过去之后,路边闪出一个老头,头发蓬松得像戴着一顶皮帽子,穿的虽然是西服,可是缝补得走了样了。他手里抱着一卷东西,匆忙地越过巷口,不提防撞到一个人。 “雷先生,这么忙!”
阅读全文
摘要:梨花她们还在园里玩,也不理会细雨丝丝穿入她们的罗衣。池边梨花的颜色被雨洗得更白净了,但朵朵都懒懒地垂着。姊姊说:"你看,花儿都倦得要睡了!"待我来摇醒它们。姊姊不及发言,妹妹的手早已抓住树枝摇了几下。花瓣和水珠纷纷地落下来,铺得银片满地,煞是好玩。妹妹说:"好玩啊,花瓣一离开树枝,就活动起来了!""
阅读全文