結果

問題 No.396 クラス替え
ユーザー yoshikiriyoshikiri
提出日時 2016-10-01 19:40:32
言語 C90
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 21,248 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-01 09:27:07
合計ジャッジ時間 1,094 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,940 KB
testcase_02 AC 0 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 0 ms
6,944 KB
testcase_05 AC 0 ms
6,940 KB
testcase_06 WA -
testcase_07 AC 15 ms
6,940 KB
testcase_08 AC 14 ms
6,944 KB
testcase_09 AC 400 ms
6,944 KB
testcase_10 AC 0 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 WA -
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 0 ms
6,944 KB
testcase_15 AC 0 ms
6,940 KB
testcase_16 WA -
testcase_17 AC 0 ms
6,940 KB
testcase_18 AC 0 ms
6,944 KB
testcase_19 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d %d %d %d",&n,&m,&x,&y);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(void){
	int n,m,x,y,k,i,flag=0;

	scanf("%d %d %d %d",&n,&m,&x,&y);

/*x,yをx<yになるようにする*/
	int temp = x;
	if(x>y){
		x=y;
		y=temp;
	}

	if((y-x)%(2*m) == 0){
		printf("YES\n");
		flag++;
	}
	else if(x%(2*m) <= m){
		k = x%(2*m);

		for(i=0;i<n/(2*m);i++){
			if((y-x) == 2*m-2*k+1+2*m*i){
				printf("YES\n");
				flag++;
			}
		}
	}
	else{
		if(x%m == 0) k = 4;
		else k = x%m;

		for(i=0;i<n/(2*m);i++){
			if((y-x) == (2*k-1)+2*m*i){
				printf("YES\n");
				flag++;;
			}
		}
	}
	if(flag!=1) printf("NO\n");

	return 0;

}
0