結果

問題 No.358 も~っと!門松列
ユーザー suppy193suppy193
提出日時 2016-04-18 13:10:37
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 561 bytes
コンパイル時間 630 ms
コンパイル使用メモリ 24,532 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-07-27 16:07:16
合計ジャッジ時間 1,617 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 0 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 0 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 0 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 0 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘check_kadomatsu’:
main.c:3:5: warning: type of ‘a1’ defaults to ‘int’ [-Wimplicit-int]
 int check_kadomatsu(a1, a2, a3)
     ^~~~~~~~~~~~~~~
main.c:3:5: warning: type of ‘a2’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:5: warning: type of ‘a3’ defaults to ‘int’ [-Wimplicit-int]

ソースコード

diff #

#include <stdio.h>

int check_kadomatsu(a1, a2, a3)
{
	if(((a1 < a2 && a2 > a3) || (a1 > a2 && a2 < a3))  && a1 != a3){
		return 1;
	}
	else{
		return 0;
	}
}

int main(void) {
	int a1, a2, a3;
	int b1, b2, b3;
	int max = 0;
	int i;
	int count = 0;
	scanf("%d%d%d", &a1, &a2, &a3);
	if(check_kadomatsu(a1, a2, a3) == 1){
		printf("INF\n");
		return 0;
	}
	max = a1;
	if(max < a2){
		max = a2;
	}
	if (max < a3){
		max = a3;
	}
	for(i = 1;i <= max;i++){
		if(check_kadomatsu(a1 % i, a2 % i, a3 % i) == 1){
			count++;
		}
	}
	printf("%d\n", count);

	return 0;
}
0