#include <iostream>
#include <stdio.h>
#include <conio.h>
using namespace std;
long long int* doing(int in1, int in2, int in3)
{
long long int doing_array[3] = {0};
int loop;
//printf("1 - %d %d %d\n",in1, in2, in3);
//printf("%d\n", sizeof(doing_array));
//for(loop=0;loop<3;loop++)
//{
doing_array[0] = in1;
doing_array[1] = in2;
doing_array[2] = in3;
//}
return doing_array;
}
int main()
{
long long int i,j,k;
//long long int *rec_array;
long long int mm[3];
int sorti, sortj;
int temp = 0 ;
//cin >> i;
//cin >> j;
//cin >> k;
while (cin >> i >> j >> k) {
//printf("%d %d %d\n",i, j, k);
//rec_array = doing(i,j,k);
//mm[0] = *rec_array;
//mm[1] = *(rec_array+1);
//mm[2] = *(rec_array+2);
//printf("2 - %d %d %d\n",*rec_array, *(rec_array+1), *(rec_array+2));
//printf("%d\n", sizeof(rec_array));
//mm[0] = *rec_array;
//mm[1] = *(rec_array+1);
//mm[2] = *(rec_array+2);
mm[0] = i;
mm[1] = j;
mm[2] = k;
//printf("3 - %d %d %d\n",mm[0], mm[1], mm[2]);
for(sorti=0;sorti<2;sorti++)
{
for(sortj=0;sortj<2;sortj++)
{
if(mm[sortj] > mm[sortj+1])
{
temp = mm[sortj];
mm[sortj] = mm[sortj+1];
mm[sortj+1] = temp;
}
}
}
if(mm[2] > mm[0] + mm[1])
printf("C\n");
else if(mm[1] > mm[0])
printf("B\n");
else
printf("A\n");
//printf("3 - %d %d %d\n",mm[0], mm[1], mm[2]);
//system("pause");
}
}
自己看錯題目意思...已解決。
#include
#include
#include
using namespace std;
long long int* doing(int in1, int in2, int in3)
{
long long int doing_array[3] = {0};
int loop;
//printf("1 - %d %d %d\n",in1, in2, in3);
//printf("%d\n", sizeof(doing_array));
//for(loop=0;loop<3;loop++)
//{
doing_array[0] = in1;
doing_array[1] = in2;
doing_array[2] = in3;
//}
return doing_array;
}
int main()
{
long long int i,j,k;
//long long int *rec_array;
long long int mm[3];
int sorti, sortj;
int temp = 0 ;
//cin >> i;
//cin >> j;
//cin >> k;
while (cin >> i >> j >> k) {
//printf("%d %d %d\n",i, j, k);
//rec_array = doing(i,j,k);
//mm[0] = *rec_array;
//mm[1] = *(rec_array+1);
//mm[2] = *(rec_array+2);
//printf("2 - %d %d %d\n",*rec_array, *(rec_array+1), *(rec_array+2));
//printf("%d\n", sizeof(rec_array));
//mm[0] = *rec_array;
//mm[1] = *(rec_array+1);
//mm[2] = *(rec_array+2);
mm[0] = i;
mm[1] = j;
mm[2] = k;
//printf("3 - %d %d %d\n",mm[0], mm[1], mm[2]);
for(sorti=0;sorti<2;sorti++)
{
for(sortj=0;sortj<2;sortj++)
{
if(mm[sortj] > mm[sortj+1])
{
temp = mm[sortj];
mm[sortj] = mm[sortj+1];
mm[sortj+1] = temp;
}
}
}
if(mm[2] > mm[0] + mm[1])
printf("C\n");
else if(mm[1] > mm[0])
printf("B\n");
else
printf("A\n");
//printf("3 - %d %d %d\n",mm[0], mm[1], mm[2]);
//system("pause");
}
}