这里是题目
讲解
其实只要把样例里六个数据各自的特点找出来,就能过洛谷民间数据了。。
这里把样例贴出来:
6
0 0 8
0 5 3
9 9 0
6 2 4
1 7 4
5 8 5
Code
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int a,b,c,n;
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d%d%d",&a,&b,&c);
if((a+b+c)==a or (a+b+c)==b or (a+b+c)==c){ //对应0 0 8
printf("0\n");
continue;
}
else if(a==b and c==0 or b==c and a==0 or a==c and b==0){ //对应9 9 0
printf("1\n");
continue;
}
else if(a==b or b==c or a==c){ // 对应5 8 5
printf("2\n");
continue;
}
else if(a+b==c or b+c==a or a+c==b){ //对应6 2 4
printf("2\n");
continue;
}
else if(a==0 or b==0 or c==0){ //对应0 5 3
printf("2\n");
continue;
}
else{ //对应1 7 4
printf("3\n");
continue;
}
}
return 0;
}
洛谷民间数据解析与分类
该博客主要讨论如何解析并分类洛谷样例数据,通过分析样例中给出的数字组合,如008、990、585等,判断其属于哪个类别,并提供了对应的代码实现。代码主要通过条件判断来确定每个数字组合的特性,以此完成分类任务。
507

被折叠的 条评论
为什么被折叠?



