计蒜客普及T3/提高T1-----T1171-T1244(仅代码)
首先是
T1171
:
#include <iostream>
#include <algorithm>
using namespace std;
struct people {
int have = 0;
int all[10010];
} p[101];
int main() {
int n;
cin >> n;
int name;
int num, temp;
for (int i = 0; i < n; ++i) {
//输入
cin >> name >> num;
for (int j = 0; j < num; ++j) {
cin >> temp;
p[temp].all[p[temp].have] = name;
p[temp].have++;
}
}
int max = 0;
for (int i = 1; i <= 100; ++i) {
//找最大
if (p[i].have > p[max].have) {
max = i;
}
}
cout << max << endl;
sort(p[max].all, p[max].all + p[max].have);
for (int i = 0; i < p[max].have; ++i) {
cout << p[max].all[i] << " ";
while (p[max].all[i] == p[max].all[i + 1])i++;//去重
}
}
T1176
#include <iostream>
#include <cstring>
using namespace std;
int num[510];//个数
char s[510],c[510][10];//字符串,分割后的字符串
int main(){
int n;
cin>>n;
cin>>s;
int max=0;
int len=strlen(s);
for (int i = 0; i < len-n+1; ++i) {
for (int j = 0; j < n; ++j) {
//分割
c[i][j]=s[j+i];
}
for (int k = 0; k <= i; ++k) {
//统计个数
if(strcmp(c[k],c[i])==0){
num[k]++;
if(num[k]>max)max=num[k];
}
}
}
if(max==1)cout<<"NO";//输出
else {
cout<<max<<endl;
for (int i = 0; i < len - n + 1; ++i) {
if(num[i]==max)cout<<c[i]<<endl;
}
}
}
T1180
#include <string>
#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;
const int MAXN = 250;
string s1,s2;
int len1,len2;
int a[MAXN],b[MAXN],c[MAXN]={
0};
void add0(string &s,int &l,int &r)
{
for (int i = l