Example #1
0
	void print(ostream& os)
	{
		if(next==NULL)
			os << val;
		else
		{
			next->print(os);
			os.width(6);
			os.fill('0');
			os << val;
		}
	}
Example #2
0
int main()
{
   void work(int,bool);
   int t;
   scanf("%d",&t);
   while (t--)
   {
      scanf("%d%d",&n,&m);
      for (int i=1;i<=n;i++)
      {
         scanf("%d%d",&a[i][0],&a[i][1]);
         a[i][1]++;
      }
      int tot=1<<n;
      ans=0;
      for (int i=0;i<tot;i++)
         work(i,false);
      for (int i=0;i<tot;i++)
         work(i,true);
      ans.print();
   }
   system("pause");
   return(0);
}