-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTableDecoration.c
56 lines (49 loc) · 1.3 KB
/
TableDecoration.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include<stdio.h>
int main()
{
int ara[3];
int table;
int l,l1,tmp;
while(3==scanf("%d%d%d",&ara[0],&ara[1],&ara[2]))
{
table=0;
if(ara[0]==ara[1] && ara[1]==ara[2]){
table+=ara[0];
ara[0]=0,ara[1]=0,ara[2]=0;
}
else{
do
{
for(l=0;l<3;l++)
{
for(l1=1;l1<3-l;l1++)
{
if(ara[l1]<ara[l1-1]){
tmp=ara[l1];
ara[l1]=ara[l1-1];
ara[l1-1]=tmp;
}
}
}
if(ara[1]+ara[0]<=(ara[2]>>1)){
table+=ara[1]+ara[0];
}
else if(ara[1]>=3){
table+=((ara[1]/3)<<1);
ara[2]-=(ara[1]/3)*3;
ara[1]-=((ara[1]/3)<<1);
}
else if(ara[1]<3){
table++;
ara[1]--;
ara[2]-=2;
}
else{
break;
}
}while(1);
}
printf("%d\n",table);
}
return 0;
}