Education codefoces round 102 div2 c

题目大意

b中单调递减的部分必须和a一样且b的字典序最大。

#include<bits/stdc++.h>

int main()
{
    
    
	int t;
	scanf("%d",&t);
	while(t--)
	{
    
    
		int n,k;
		scanf("%d%d",&n,&k);
		for(int i=1;i<2*k-n;i++)
		{
    
    
			printf("%d ",i);
		}
		for(int i=k;i>=k*2-n;i--)
		{
    
    
			printf("%d",i);
			if(i==k)
			{
    
    
				printf("\n");
			}
			else
			{
    
    
				printf(" ");
			}
		}
	}
}

猜你喜欢

转载自blog.csdn.net/p15008340649/article/details/113184932