Bestcoder Round 15# 1001 Love
2014-10-25 22:21
288 查看
很简单的一个字符串查找和输出问题,不用多说了,见到'_'就做一个标记,不断地更新就行了。。。
# include<cstdio> # include<iostream> # include<cstring> # include<algorithm> using namespace std; char str1[30]; char str2[30]; char str3[100]; int main(void) { memset(str1,0,sizeof(str1)); memset(str2,0,sizeof(str2)); //memset(str3,0,sizeof(str3)); //int t = 0; //int m = 0; while ( scanf("%s %s",str1,str2)!=EOF ) { int t = 0; int m = 0; memset(str3,0,sizeof(str3)); int n1 = strlen(str1); int n2 = strlen(str2); for ( int i = 0;i < n1;i++ ) { if ( str1[i]=='_' ) { for ( int j = i;j < n1;j++,m++ ) { str3[m] = str1[j+1]; } } } t = m; m++; for ( int i = 0;i < n2;i++ ) { if ( str2[i]=='_' ) { for ( int j = i;j < n2;j++,m++ ) { str3[m] = str2[j+1]; } } } for ( int i = 0;i < t-1;i++ ) { cout<<str3[i]; } cout<<"_small_"; for ( int i = t+1;i < m-1;i++ ) cout<<str3[i]; printf("\n"); } return 0; }
相关文章推荐
- BestCoder Round #33——1001——zhx's submissions
- BestCoder Round 69 Div 2 1001&& 1002 || HDU 5610 && 5611
- BestCoder Round #18 1001 primes problem
- BestCoder Round 38-1001 Four Inages Strategy
- bestcoder Round-#7 1001 Little Pony and Permutation
- [Bestcoder] Valentine's Day Round 1001 - Ferries Wheel | HDU 5174
- BestCoder Round #34 1001 Go to movies
- BestCoder Round #50 (div.2) 1001
- HDU5104 Primes Problem && BestCoder Round #18 1001
- BestCoder Round #64 1001
- BestCoder Round #81 (div.2)1001
- hdu 4883 bestcoder round 2 1001 TIANKENG’s restaurant
- BestCoder Round #16 1001 Revenge of Segment Tree 1002 Revenge of LIS II
- HDU 5104 Primes Problem(拆分素数和问题)【BestCoder Round #18 1001】
- BestCoder Round #78 1001/ hdu 5655 CA Loves Stick
- hdu 4956 Poor Hanamichi(bestcoder Round 6 1001)
- BestCoder Round#29 1001 GTY's math problem
- BestCoder Round #32——1001——PM2.5
- BestCoder Round #70 1001 Jam's math problem
- Bestcoder Round #48 1001、1002