結果

問題 No.1366 交換門松列・梅
ユーザー pengin_2000
提出日時 2021-03-14 03:02:32
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 604 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 27,088 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-20 11:01:46
合計ジャッジ時間 788 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:17:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |                 scanf("%d", &a[i]);
      |                 ^~~~~~~~~~~~~~~~~~
main.c:19:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |                 scanf("%d", &b[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int f(int a[])
{
	if (a[0] == a[1] || a[1] == a[2] || a[0] == a[2])
		return -1;
	if (a[0]<a[1] && a[1]>a[2])
		return 1;
	if (a[0] > a[1] && a[1] < a[2])
		return 1;
	return -1;
}
int main()
{
	int a[3], b[3];
	int i, j;
	for (i = 0; i < 3; i++)
		scanf("%d", &a[i]);
	for (i = 0; i < 3; i++)
		scanf("%d", &b[i]);
	for (i = 0; i < 3; i++)
	{
		for (j = 0; j < 3; j++)
		{
			a[i] ^= b[j];
			b[j] ^= a[i];
			a[i] ^= b[j];
			if (f(a) > 0 && f(b) > 0)
			{
				printf("Yes\n");
				return 0;
			}
			a[i] ^= b[j];
			b[j] ^= a[i];
			a[i] ^= b[j];
		}
	}
	printf("No\n");
	return 0;
}
0