programming-challenges Common Permutation (110303) 题解
来源:互联网 发布:java xml转换成对象 编辑:程序博客网 时间:2024/05/19 18:44
蛮简单的,就是输入一定要用getline,用cin是过不了的。
#include <iostream>#include <sstream>#include <fstream>#include <string>#include <vector>#include <queue>#include <map>#include <set>#include <stack>#include <assert.h>#include <algorithm>#include <math.h>#include <ctime>#include <functional>#include <string.h>#include <stdio.h>#include <numeric>#include <float.h>using namespace std;int main() {string s1, s2; while (getline(cin, s1) && getline(cin, s2)) {string ans;sort(s1.begin(), s1.end());sort(s2.begin(), s2.end());int i1 = 0, i2 = 0; while (i1 < s1.size() && i2 < s2.size()) {if (s1[i1] == s2[i2]) {ans.push_back(s1[i1]);i1++; i2++;}else if (s1[i1] < s2[i2]) {i1++;}else {i2++;}}cout << ans << endl;}return 0;}
0 0
- programming-challenges Common Permutation (110303) 题解
- programming-challenges WERTYU (110301) 题解
- programming-challenges ShellSort (110407) 题解
- programming-challenges Ones (110504) 题解
- programming-challenges Chopsticks (111107) 题解
- programming-challenges Bicoloring (110901) 题解
- programming-challenges Crypt Kicker (110204) 题解
- programming-challenges Stack 'em Up (110205) 题解
- programming-challenges Poker Hands (110202) 题解
- programming-challenges Contest Scoreboard (110207) 题解
- programming-challenges Where's Waldorf? (110302) 题解
- programming-challenges Crypt Kicker II (110304) 题解
- programming-challenges Automated Judge Script (110305) 题解
- programming-challenges File Fragmentation (110306) 题解
- programming-challenges Vito's Family (110401) 题解
- programming-challenges Stacks of Flapjacks (110402) 题解
- programming-challenges Longest Nap (110404) 题解
- programming-challenges Shoemaker's Problem (110405) 题解
- 史上最全最强SpringMVC详细示例实战教程
- 高并发量网站解决方案
- programming-challenges Where's Waldorf? (110302) 题解
- wds和extap作为cpe区别
- Android属性动画备忘
- programming-challenges Common Permutation (110303) 题解
- “CsGL.OSLib”的类型初始值设定项引发异常“的解决办法
- 面试常见算法-排序查找算法
- pv小总结
- PHP 扩展库
- PHP 能做什么?
- P10显示模块移动分析
- pv操作
- 一个AP无线性能优化案例