A
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int suma=0;
int sumb=0;
int a,b;
while(n--){
cin>>a>>b;
suma+=a;
sumb+=b;
}
if(suma>sumb)cout<<"Takahashi"<<endl;
else if(suma<sumb)cout<<"Aoki"<<endl;
else if(suma==sumb)cout<<"Draw"<<endl;
return 0;
}
B
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
cin>>s;
string s0=s;
for(auto i:s){
if(i!='A'&&i!='B'&&i!='C'){
cout<<"No"<<endl;
return 0;
}
}
sort(s.begin(),s.end());
if(s0==s)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
C
#include<bits/stdc++.h>
using namespace std;
struct people{
int id;
int num;
};
bool cmp(people a,people b){
return a.num<b.num;
}
int finds(people a[],int size,int key){
int low = 0;
int high = size-1;
int mid;
while(low <= high)
{
mid = low+(high-low>>1);
if(key < a[mid].num)
high = mid-1;
else if(key > a[mid].num)
low = mid+1;
else
return mid;
}
return -1;
}
int main()
{
int n;
cin>>n;
people a[n];
int key;
for(int i=0;i<n;i++){
a[i].id=i+1;
cin>>a[i].num;
if(a[i].num==-1)key=a[i].id;
}
cout<<key<<" ";
sort(a,a+n,cmp);
int n0=n-1;
while(n0--){
key=a[finds(a,n,key)].id;
cout<<key<<" ";
}
return 0;
}
文章来源地址https://www.toymoban.com/news/detail-812778.html
文章来源:https://www.toymoban.com/news/detail-812778.html
到了这里,关于ABC337(A-C)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!