?? 3058.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 + -