摘要: #include<iostream>usingnamespacestd;intmain(){intL,i,j,n;booltrees[10001];for(i=0;i<10001;i++)trees[i]=true;cin>>L>>n;for(i=0;i<n;i++){intbegin,end;cin>>begin>>end;for(j=begin;j<=end;j++)trees[j]=false;}intcount=0;for(i=0;i<=L;i++)if(trees[i])count++;cout< 阅读全文
posted @ 2012-04-09 20:14 逝者*恋世 阅读(169) 评论(0) 推荐(0) 编辑
摘要: 利用归并求逆序对DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. For the input sequence9 1 0 5 4 ,Ultra-QuickSort produces the 阅读全文
posted @ 2012-04-09 19:36 逝者*恋世 阅读(225) 评论(0) 推荐(0) 编辑
摘要: #include <iostream>using namespace std;int jz(int n,int y){if(n/8==0) return (n+y);elsey=y+n/8*10;y=jz(n%8,y);return y;}int main(){int x,y;cin>>x;y=jz(x,0);cout<<y<<endl;return 0;} 阅读全文
posted @ 2012-04-09 19:14 逝者*恋世 阅读(152) 评论(0) 推荐(0) 编辑