(from luckycat)
解法:
字串。
注意:
程式碼:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Tittle: 10361 - Automatic Poetry | |
* Author: Cheng-Shih, Wong | |
* Date: 2015/07/09 | |
*/ | |
// include files | |
#include <bits/stdc++.h> | |
using namespace std; | |
// definitions | |
#define FOR(i,a,b) for( int i=(a),_n=(b); i<=_n; ++i ) | |
#define clr(x,v) memset( x, v, sizeof(x) ) | |
#define N 205 | |
// declarations | |
int n; | |
char s[6][N]; | |
char buf[N]; | |
// functions | |
// main function | |
int main( void ) | |
{ | |
char *cptr; | |
int cnt; | |
// input | |
scanf( "%d", &n ); | |
gets(buf); | |
while( n-- ) { | |
clr( s, 0 ); | |
gets(buf); | |
cnt = 1; | |
cptr = s[1]; | |
FOR( i, 0, strlen(buf)-1 ) { | |
if( buf[i]=='<' || buf[i]=='>' ) | |
cptr = s[++cnt]; | |
else | |
*(cptr++) = buf[i]; | |
} | |
gets(buf); | |
sscanf( buf, "%[^.]", s[0] ); | |
// output | |
FOR( i, 1, 5 ) printf( "%s", s[i] ); | |
putchar('\n'); | |
printf( "%s%s%s%s%s\n", | |
s[0], s[4], s[3], s[2], s[5] ); | |
} | |
return 0; | |
} |
沒有留言:
張貼留言
任何意見都樂意傾聽