#include<iostream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
using namespace std;
int n, k;
double arr[30][30];
double sum[30];
double sum1[30];
int n1[30];
int ave[30];
struct student
{
double score;
int team;
};
vector<student>v;
int round_0(double n)
{
if (n > 0)
return n - int(n) >= 0.5 ? int(n) + 1 : int(n);
else
return -n - int(-n) >= 0.5 ? -(int(-n) + 1) : -int(-n);
}
bool cmp(student stu1, student stu2)
{
if (stu1.score == stu2.score)
{
return stu1.team < stu2.team;
}
return stu1.score > stu2.score;
}
int main()
{
cin >> n >> k;
student stu;
char ch;
double s;
for (int i = 1;i <= n;i++)
{
cin >> s;
cin >> ch;
int c = int(ch - 64);
stu.score = s;
stu.team = c;
v.push_back(stu);
}
for (int i = 1;i <= k;i++)
{
for (int j = 1;j <= k;j++)
{
cin >> arr[i][j];
sum[j] += arr[i][j];
sum1[j] += arr[i][j];
}
}
for (int i = 1;i <= k;i++)
{
for (int j = 1;j <= k;j++)
{
if (abs(arr[i][j] - sum[j] / k) > 15)
{
n1[j]++;
sum1[j] -= arr[i][j];
}
}
}
for (int i = 1;i <= k;i++)
{
ave[i] = round(sum1[i] / (k - n1[i]));
//cout << ave[i] << " ";
}
for (vector<student>::iterator it = v.begin();it != v.end();it++)
{
int x = (*it).team;
(*it).score = round(((*it).score * 6 + ave[x] * 4) / 10);
}
sort(v.begin(), v.end(), cmp);
for (vector<student>::iterator it = v.begin();it != v.end();it++)
{
cout << fixed << setprecision(0) << (*it).score << ' ';
cout << char((*it).team + 64) << endl;
}
return 0;
}
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
bool is[50005];
bool use[26];
int main()
{
string str;
cin >> str;
int len = str.length();
int cnt = len;
for (int i = 0;i < str.length();i++)
{
memset(use, 0, sizeof(use));
use[int(str[i]) - 97] = true;
if (str[i] == str[i + 1]) {
is[i] = 1;
cnt += 1;
}
for (int j = 1;j <= str.length();j++)
{
if (j + i >= len || i - j < 0||str[i+j]!=str[i-j]|| use[int(str[i + j])-97]==true)break;
cnt++;
use[i + j] = true;
use[i - j] = true;
/*for (int z = i-j;z <= j + i;z++)
{
cout << str[z];
}
cout << endl;*/
}
}
for (int i = 0;i < str.length();i++)
{
memset(use, 0, sizeof(use));
if (is[i])
{
use[int(str[i]) - 97] = true;
for (int j = 1;j <= str.length();j++)
{
if (j + i + 1 >= len || i - j < 0 || str[i + j + 1] != str[i - j] || use[int(str[i + j + 1]) - 97] == true)break;
cnt++;
use[i +1+ j] = true;
use[i - j] = true;
}
}
}
cout << cnt << endl;
return 0;
}
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 备战蓝桥杯1
发表评论 取消回复