16 最大值 入门难度
#include <iostream>
#include <algorithm>
using namespace std;
int n1,n2,n3;
int main() {
cin>>n1>>n2>>n3;
cout<<max(n1,max(n2,n3));
return 0;
}
17 含k个3的数 入门难度
#include <bits/stdc++.h>
using namespace std;
int main(){
long long n,k;
cin>>n>>k;
long long _n=n;
int cnt=0;
while(n!=0){
if(n%10==3)
cnt++;
n/=10;
}
if((cnt==k)&&(_n%19==0))
cout<<"YES";
else
cout<<"NO";
return 0;
}
18 三角形判定 入门难度
#include <iostream>
using namespace std;
int a,b,c;
int main()
{
cin>>a;
cin>>b;
cin>>c;
if (a+b>c&&a+c>b&&b+c>a)
{
cout<<"Yes";}
else{
cout<<"No";}
return 0;
}
19 谁考了第k名 入门难度
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
struct e {
string c;
double d;
};
e a[101];
bool cmp(e a, e b) {
return a.d > b.d;
}
int main() {
int i, n, k;
cin >> n >> k;
for (i = 1; i <= n; i++) {
cin >> a[i].c >> a[i].d;
}
sort(a + 1, a + 1 + n, cmp);
cout << a[k].c << " " << a[k].d;
return 0;
}
20 菱形变形 入门难度
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin>>n;
int a=n-1;
int b=1;
for (int i=1;i<=n;i++){
for (int j=1;j<=a;j++){
cout<<" ";
}
for (int k=1;k<=b;k++){
cout<<"*";
}
cout<<endl;
a--;
b+=2;
}
n--;
int c=1;
int d=2*n-1;
for (int i=1;i<=n;i++){
for (int j=1;j<=c;j++){
cout<<" ";
}
for (int k=1;k<=d;k++){
cout<<"*";
}
cout<<endl;
c++;
d-=2;
}
return 0;
}