結果

問題 No.91 赤、緑、青の石
ユーザー suppy193suppy193
提出日時 2016-11-10 13:37:29
言語 C90
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 811 bytes
コンパイル時間 1,602 ms
コンパイル使用メモリ 24,160 KB
実行使用メモリ 6,108 KB
最終ジャッジ日時 2023-08-16 17:31:55
合計ジャッジ時間 8,899 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
4,376 KB
testcase_01 AC 9 ms
4,380 KB
testcase_02 AC 5 ms
4,380 KB
testcase_03 AC 10 ms
4,380 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 11 ms
4,376 KB
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

void swap(int *a, int *b)
{
	int temp;
	temp = *a;
	*a = *b;
	*b = temp;
}

void sort(int *s)
{
	if(s[0] > s[1]){
		swap(&s[0], &s[1]);
	}
	if(s[1] > s[2]){
		swap(&s[1], &s[2]);
	}
	if(s[0] > s[1]){
		swap(&s[0], &s[1]);
	}
}

int main(void) {
	int i;
	int a = 0;
	int s[3];
	scanf("%d%d%d", &s[0], &s[1], &s[2]);
	sort(s);
	//printf("%d %d %d:%d\n\n", s[0], s[1], s[2], a);

	a += s[0];
	s[2] -= s[0];
	s[1] -= s[0];
	s[0] = 0;
	sort(s);
	//printf("%d %d %d:%d\n", s[0], s[1], s[2], a);

	while(1){
		if((s[0] == 0 && s[1] == 0 && s[2] < 5) 
		|| (s[0] == 0 && s[1] == 1 && s[2] < 3)
		|| (s[0] == 0 && s[1] == 2 && s[2] == 2)){
			break;
		}
		a++;
		s[0] = 0;
		s[1]--;
		s[2] -= 3;
		sort(s);
		//printf("%d %d %d:%d\n\n", s[0], s[1], s[2], a);
	}
	
	printf("%d\n", a);
		
	return 0;
}
0