昨晚的比赛没有做,今天直接补的。做出了A,B两题。
A. Little C Loves 3 I X5323
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
int n,a,b,c;
scanf("%d",&n);
if(n%3==0){
if(n%9!=0){
a=b=c=n/3;
}else{
int tmp=n/3;
a=tmp-2;
b=c=tmp+1;
}
}else{
int tmp=n/3;
if(tmp%3==0){
a=tmp-1;
b=tmp+1;
c=tmp+n%3;
}else{
a=tmp;
if(tmp%3==n%3){
b=tmp;
c=tmp+n%3;
}else{
if(n%3==2){ //tmp%3==1
b=tmp+1;
c=tmp+1;
}else{ //n%3==1&&tmp%3==2
b=tmp-1;
c=tmp+2;
}
}
}
}
printf("%d %d %d\n",a,b,c);
return 0;
}
B. Cover Points X5099
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
ll n,a,b,ans=0;
scanf("%lld",&n);
while(n--){
scanf("%lld%lld",&a,&b);
ans=max(ans,a+b);
}
printf("%lld\n",ans);
return 0;
}
C. Enlarge GCD X1384