T2382.数字翻转比大小
#include<bits/stdc++.h>
using namespace std;
int x,y;
int fanzhuan(int x){
int num=0;
while(x>0){
num+=x%10;
x=x/10;
num=num*10;
}
num=num/10;
return num;
}
int main() {
freopen("interval.in","r",stdin);
freopen("interval.out","w",stdout);
cin>>x>>y;
// cout<<fanzhuan(x)<<fanzhuan(y);
cout<<max(fanzhuan(x),fanzhuan(y));
fclose(stdin);
fclose(stdout);
return 0;
}
T2381.八季之殇
#include<bits/stdc++.h>
using namespace std;
int s_index;
int m[5];
int p[10];
int main() {
freopen("season.in","r",stdin);
freopen("season.out","w",stdout);
for(int i=1;i<=8;i++){
int mx=-1,mn=805;
for(int j=1;j<=3;j++){
cin>>m[j];
if(m[j]>mx){
mx=m[j];
}
if(m[j]<mn){
mn=m[j];
}
}
p[i]=mx-mn;
}
int maxx=-1,minn=805;
for(int i=1;i<=8;i++){
if(p[i]>maxx){
maxx=p[i];
}
if(p[i]<minn){
minn=p[i];
}
}
s_index=maxx-minn;
cout<<s_index;
fclose(stdin);
fclose(stdout);
return 0;
}
T2383.我到底是个啥
#include<bits/stdc++.h>
using namespace std;
int n;
int a,b,c;
string s;
int main() {
freopen("who.in","r",stdin);
freopen("who.out","w",stdout);
cin>>n;
for(int i=1;i<=n+1;i++){
string s={};
getline(cin,s);
int l=s.size();
for(int i=0;i<l;i++){
if(s[i]=='A'){
a++;
}else if(s[i]=='B'){
b++;
}else if(s[i]=='C'){
c++;
}
}
}
int maxx=-1;
if(maxx<a){
maxx=a;
}
if(maxx<b){
maxx=b;
}
if(maxx<c){
maxx=c;
}
// cout<<a<<" "<<b<<" "<<c<<endl;
// cout<<maxx<<endl;
if(a==maxx){
cout<<"human";
}
if(b==maxx){
cout<<"puppy";
}
if(c==maxx){
cout<<"saiyan";
}
fclose(stdin);
fclose(stdout);
return 0;
}