⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 3058.txt

📁 北大ACM题目例程 详细的解答过程 程序实现 算法分析
💻 TXT
字号:
Source

Problem Id:3058  User Id:fzk 
Memory:3988K  Time:593MS
Language:G++  Result:Accepted

Source 

#include <stdio.h>
#include <algorithm>
#include <memory.h>
using namespace std;

int w1[1000000];


int main() {
	int t, i, j, m;
	char c, temp;

	scanf( "%d", &t );
	getchar();

	while( t-- ) {

		m = 0;

		while( 1 ){
			c = getchar();
			
			if( c == '\n' )
				break;
			
			if( c >= '0' && c <= '9' ) {
				j = 0;
				while( c >= '0' && c <= '9' ) {
					j = j*10 + c-'0';
					c = getchar();
				}
				while( --j ) {
					w1[m] = (temp<<20)|m;
					m++;
				}

				ungetc( c, stdin );
			}
			else {
				w1[m] = (c<<20)|m;
				m++;
			}

			temp = c;
		}

	
		sort( w1, w1+m );

		for( j = (w1[0]&((1<<20)-1)), i=0; i<m; i++ ) {
			printf( "%c", w1[j]>>20 );
			j = (w1[j]&((1<<20)-1));
		}
		printf( "\n" );

	}
	return 0;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -