首页 > 代码库 > codeforces 589a(构造的字符串后,最后要加终止符,,,)
codeforces 589a(构造的字符串后,最后要加终止符,,,)
模拟注意细节,没什么好说的
#include <cstdio>#include <cstring>#include <vector>#include <algorithm>#include <iostream>#include <map>#include <queue>#include <stack>#include <cmath>//#pragma comment(linker, "/STACK:102400000,102400000")using namespace std;#define PF(x) cout << "debug: " << x << " ";#define EL cout << endl;#define PC(x) puts(x);typedef long long ll;#define CLR(x, v) sizeof (x, v, sizeof(x))using namespace std;const int INF = 0x5f5f5f5f;const int maxn = 2e4 + 10;const int mod = 1e9 + 7;const double eps = acos(-1);const double PI= atan(1.0)*4;map<string,int>q,q1;vector<string>st[maxn];int n,cnt;char ck[20] = {"bmail.com"};int main(){ // freopen("in.txt","r",stdin); cin>>n; // cout<<n<<endl; // cout<<ck<<endl; //for(int i = 0;i < 9;i++) // cout<<ck[i]<<endl; int num = ‘a‘ - ‘A‘ + 0; //cout<<num<<endl; char ss[350]; for(int i = 1;i <= n;i++){ // char ss[350]; char ss1[350],ss2[350]; scanf("%s",ss); //cout<<ss<<endl; int l = strlen(ss); int cnt1 = -1,cnt2 = -1,fg = 0,fg2 = 0,pos; for(int j = 0;j < l;j++){ if(ss[j] >= ‘A‘&&ss[j] <= ‘Z‘){ ss1[++cnt1] = ss[j] + num; if(fg2 == 0||fg2 == 2) ss2[++cnt2] = ss[j] + num; // cout<<ss1[cnt1]<<endl; } if(ss[j] >= ‘a‘&&ss[j] <= ‘z‘){ ss1[++cnt1] = ss[j]; if(fg2 == 0||fg2 == 2) ss2[++cnt2] = ss[j]; } if(ss[j] == ‘.‘){ ss1[++cnt1] = ss[j]; if(fg2 == 2) ss2[++cnt2] = ss[j]; } if(ss[j] == ‘+‘){ ss1[++cnt1] = ss[j]; fg2 = 1; } if(ss[j] == ‘@‘){ pos = j; fg2 = 2; ss1[++cnt1] = ‘@‘; ss2[++cnt2] = ‘@‘; } //cout<<ss1[cnt1]<<endl; } int t = 0; pos++; if(l - pos == 9) for(t = pos;t < l;t++){ // cout<<ss[t]<<endl; // cout<<ck[t-pos]<<endl; if(t != pos + 5){ //cout<<ss[t]<<" "<<ck if(ss[t] != ck[t-pos]&&ss[t] != ck[t-pos]-num) break; } else{ if(ss[t] != ‘.‘) break; } } //cout<<ss1<<" "<<ss2<<endl; // printf("%s %s\n",ss1,ss2); for(int i = cnt1+1;i < strlen(ss1);i++) ss1[i] = ‘\0‘; for(int i = cnt2+1;i< strlen(ss2);i++) ss2[i] = ‘\0‘; // cout<<" "; // cout<<ss1<<" "<<ss2<<endl; if(t == l) fg = 1; //cout<<fg<<endl;*/ if(fg == 0){ if(q[ss1] > 0) st[q[ss1]].push_back(ss); else{ q[ss1] = ++cnt; st[cnt].push_back(ss); } } else{ if(q1[ss2] > 0) st[q1[ss2]].push_back(ss); else{ q1[ss2] = ++cnt; st[cnt].push_back(ss); } } } cout<<cnt<<endl; for(int i = 1;i <= cnt;i++){ int num1 = st[i].size(); printf("%d ",num1); for(int j = 0;j < num1;j++){ cout<<st[i][j]; if(j == num1 - 1) printf("\n"); else printf(" "); } } return 0;}
codeforces 589a(构造的字符串后,最后要加终止符,,,)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。