#include<bits/stdc++.h>#define int long long#define endl '\n'using namespace std;
int tong[155];
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int maxn = 0;
for(int i = 1;i<=4;i++)
{
string s;
getline(cin,s);
for(int j = 0;j<s.size();j++)
{
tong[s[j]]++;
if(s[j]>='A'&&s[j]<='Z')
{
maxn = max(maxn,tong[s[j]]);
}
}
}
for(int i = maxn;i>=1;i--)//
{
for(int j = 'A';j<='Z';j++)
{
if(tong[j] >= i) cout<<"* ";
else cout<<" ";
}
cout<<endl;
}
cout<<"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z";
return 0;
}
4.错因:题虽然看懂了,但完全不知道如何下手
T7 T805946 T7
1.题意:先输入n,x,接着求获奖的最低分数,最后求有多少人获奖,输出获奖的分数。
2.思路:先求分数,接着从600-0依次遍历,如果cnt>=fs,输出j,然后break;
3.AC代码:
C++
#include<bits/stdc++.h>#define int long long#define endl '\n'using namespace std;
int tong[605];
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n,w;
cin>>n>>w;
for(int i = 1;i<=n;i++)
{
int x;
cin>>x;
tong[x]++;
int fs = max(1ll,i*w/100);
int cnt = 0;
for(int j = 600;j>=0;j--)
{
cnt += tong[j];
if(cnt >= fs)
{
cout<<j<<" ";
break;
}
}
}
return 0;
}