c++ 字符串基础

HDOJ 2072, HDOJ 2081

/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <bits/stdc++.h>

typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	string str;
	while(getline(cin, str) && str[0] != '#') {
		set<string> words;

		stringstream ss(str);
		string num;
		while(ss >> num)	words.insert(num);
		cout << words.size() << "\n";
	}
	return 0;
}
/**/
/**/
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <string>
#include <stack>
#include <queue>

typedef long long LL;
typedef unsigned long long ULL;
using namespace std;

const int maxn = 12;
char str[maxn];

int main()
{
	//freopen("in.txt", "r", stdin);
	//freopen("out.txt", "w", stdout);
	int n;
	cin >> n;
	while(n--) {
		string ans = "6";
		cin >> str;
		ans += str + 6;
		cout << ans << endl;
	}
	return 0;
}
/**/

猜你喜欢

转载自blog.csdn.net/wen__han/article/details/82687268